Guest User

Untitled

a guest
May 26th, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.95 KB | None | 0 0
  1. jeffl@ubuntu:~/vault_testing$ cat vars/secrets.yml
  2. ---
  3. username: jeffl
  4. password: secretpassword
  5. jeffl@ubuntu:~/vault_testing$
  6.  
  7. jeffl@ubuntu:~/vault_testing$ echo "my_vault_pass" > vault_pass
  8. jeffl@ubuntu:~/vault_testing$ chmod go-r vault_pass
  9.  
  10. jeffl@ubuntu:~/vault_testing$ ansible-vault encrypt --vault-id vault_pass vars/secrets.yml
  11. Encryption successful
  12. jeffl@ubuntu:~/vault_testing$ cat !$
  13. cat vars/secrets.yml
  14. $ANSIBLE_VAULT;1.1;AES256
  15. 32353463666361373361626431343536313862356430663738306261396337653239326533353439
  16. 3336303361643236326562303663663733326537363864320a336332373231303032666261343066
  17. 61643565303665616637343437336233366136663265373138616238633333626632343062373738
  18. 6631323336373361660a306232653136383539386135663732366632353732313061323637653565
  19. 31346565363030323461343937623736623532613232383933373531366362636165306432633632
  20. 6434643235623530353333666164383136376239326431643636
  21. jeffl@ubuntu:~/vault_testing$ cat vault_test.yml
  22. ---
  23. - name: Test ansible vault functionality
  24. hosts: 127.0.0.1
  25. vars_files:
  26. - vars/secrets.yml
  27.  
  28. tasks:
  29. - name: Print username variable to the screen
  30. debug:
  31. var: username
  32. jeffl@ubuntu:~/vault_testing$ ansible-playbook --vault-id vault_pass vault_test.yml
  33. [WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not
  34. match 'all'
  35.  
  36.  
  37. PLAY [Test ansible vault functionality] *****************************************************************************
  38.  
  39. TASK [Gathering Facts] **********************************************************************************************
  40. ok: [127.0.0.1]
  41.  
  42. TASK [Print username variable to the screen] ************************************************************************
  43. ok: [127.0.0.1] => {
  44. "username": "jeffl"
  45. }
  46.  
  47. PLAY RECAP **********************************************************************************************************
  48. 127.0.0.1 : ok=2 changed=0 unreachable=0 failed=0
  49.  
  50. jeffl@ubuntu:~/vault_testing$
Add Comment
Please, Sign In to add comment