How do i get ansible to read the vault password automatically on the cli?



  • When using the ansible vault feature to encrypt sensitive information, you need to enter the path to the vault password or it prompts you for a password.

    Ansible allows you to keep a file in safe secure directory with the password and then set the variable ANSIBLE_VAULT_PASSWORD_FILE

    $ export ANSIBLE_VAULT_PASSWORD_FILE=<your path>

    After setting it the variable, then the cli below

    $ ansible-playbook site.yml --vault-password-file ~/.vault_pass.txt
    

    becomes

    $ ansible-playbook site.yml
    

Log in to reply
 

© Lightnetics 2024