Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 1). STORE YOUR VAULT PASSWORD IN A FILE
- ```
- echo "<SOME_PASSWORD>" > ~/.vault_pass.txt
- ```
- 2). ENCRYPTING A FILE:
- Before encrypting ...
- ```
- $ cat group_vars/all
- ansible_ssh_user: root
- ansible_ssh_password: <SOME_PASSWORD>
- ```
- Encrypt ...
- ```
- $ ansible-vault encrypt group_vars/all
- [You will be prompted for vault password]
- ```
- Look at the results ...
- ```
- $ cat group_vars/all
- $ANSIBLE_VAULT;1.1;AES256
- 32636530636135626164616334623564623132663139636436646163663035346239663232666233
- 6666633735653535666132306533653061323262656338320a333566356433326563636537386564
- 66396337616333646565333566356632646530623536636166316639363135373364646130643230
- 3937346363356165380a353665646138316663653237376238333038303637336430336333616139
- 36303165353138366232333430643362356531343030366363613264303137366662343533303766
- 65363234343337326234346335303035613439363934633765323964323865373334653836613434
- 61373832623935353866363934623866303837343164386565306533306334376163313364363839
- 33373435643565323865653963653839656361646162333434333136383563636631386465376666
- 62643062613863343165393033376637393332356266396134353035396264313861
- ```
- 3). TO DECRYPT A FILE:
- Decrypt ...
- ```
- ansible-vault decrypt group_vars/all
- [You will be prompted for vault password]
- ```
- Look at the results ...
- ```
- $ cat group_vars/all
- ansible_ssh_user: root
- ansible_ssh_password: <SOME_PASSWORD>
- ```
- 4). PROVIDE VAULT PASSWORD IN PLAYBOOK RUN TO USE ENCRYPTED VAR FILE
- ```
- ansible-playbook -i hosts -u someuser --vault-password-file ~/.vault_pass.txt
- ```
Add Comment
Please, Sign In to add comment