Working With Ansible Vault

0 51

Ansible Vault is a way to keep sensitive information in encrypted files. rather than plain text, in your playbooks

  1. Navigate to /home/ec2-user/ansible/vars and create ansible secret store file by running:
    ansible-vault create vars/secret-variable.yml

    Enter the password twice

  2. Now lets enter some secrets inside this file, as follows:
    secret_password: "supersecretpassword123"
  3. Now try to vim in secret-variable.yml
  4. For editing secret-variable.yml, run following command:
    ansible-vault edit vars/secret-variable.yml
  5. Now lets use this in our setup-app playbook, please refer this link
  6. Run playbook with following command:
    ansible-playbook playbooks/setup-app.yml --ask-vault-pass

Leave A Reply

Your email address will not be published.