Monday, 19 August 2019

What is ansible vault by Raj Gupta


[ansible@ip-172-31-80-19 ~]$ vi inventory.txt
[ansible@ip-172-31-80-19 ~]$ cat inventory.txt
[webservers]
172.31.85.190
webserver1 ansible_host=172.31.85.190 amsible_ssh_pass=password ansible_connection=ssh ansible_port=22 ansible_user=root
[ansible@ip-172-31-80-19 ~]$ ansible-vault encrypt inventory.txt --output enc_inven.txt
New Vault password:
Confirm New Vault password:
Encryption successful

[ansible@ip-172-31-80-19 ~]$ cat enc_inven.txt
$ANSIBLE_VAULT;1.1;AES256
66666566653538383138613665333239613764613133666362653039363464663130343538663966
3637343134376163353039643030373733353233363066320a386261646465656564373364363137
37343130613438663031373634353662613061623032303464613635623433376330663265373739
3537633765343963370a346432643161343039303739343661326631393461396131333233333261
63356263396165323335643664346164346666656461316465643839393964323936623332363332
32353465646361393761313535313366393939343437376462333664376137316639613935376539
63326132623863396130363862326432353731373662633535376263623538303062356562333038
35316436303063643532626136636238366636326233313466316365313761643638363261306366
64303462643935613766393532313165393437336539636464323361316436313734646632363937
35333266303830653136343835666439373831333465323765303063346433386130383136353361
31343837336563383237653535636364363537333765613566616161353638363339326332323961
31643635646236356566
[ansible@ip-172-31-80-19 ~]$ ansible-vault view enc_inven.txt
Vault password:
[webservers]
172.31.85.190
webserver1 ansible_host=172.31.85.190 amsible_ssh_pass=password ansible_connection=ssh ansible_port=22 ansible_user=root

[ansible@ip-172-31-80-19 ~]$ ansible-playbook -i enc_inven.txt jinja2.yml --ask-vault-pass
Vault password:


No comments:

Post a Comment