Check https://developer.hashicorp.com/vault/tutorials/getting-started/getting-started-first-secret
Add the VAULT Address to your Environement. You might want it to persist.
export VAULT_ADDR=x.y.x.z:8200
You may also want to disbale TLS Certficate verification.
You can do that by accessing the vault config file (/etc/vaults or create one in the working directory) and set tls_disable
=1. Refer to Vault Config for more Details.
You might have forgotten to enable the secret engine.
vault secrets enable -version=2 -path=secret kv
To add secrets, you first need to enable the secrets.
To add keys in a secret path:
vault kv put secret/my-app/ password=123
Here, you are adding the key password
in secret path secret/my-app
To add multiple keys to your secret path
vault kv put secret/my-app/cred username=xyz password=123
Here, you are adding the keys password
and username
in secret path secret/my-app/cred
For more examples refer https://blog.ruanbekker.com/blog/2019/05/06/setup-hashicorp-vault-server-on-docker-and-cli-guide/
You need to generate a ssh key pair in the local machine (Where ansible script is present) and copy the public key onto the Target Machine.