ansible playbook加密

1、加密

[root@localhost tasks]# ansible-vault encrypt main.yml 
New Vault password: 
Confirm New Vault password: 
Encryption successful

2、查看加密的playbook内容

[root@localhost tasks]# ansible-vault view main.yml 
Vault password: 

3、编辑加密的playbook

[root@localhost tasks]# ansible-vault edit main.yml 
Vault password: 

4、修改密码

[root@localhost tasks]# ansible-vault rekey main.yml 
Vault password: 

5、加密后的playbook不能直接运行,需要加选项输入密码

[root@localhost ansible]# ansible-playbook --ask-vault-pass roles/redis.yml 
Vault password: 

6、解密

[root@localhost tasks]# ansible-vault decrypt main.yml 
Vault password: 
Decryption successful

你可能感兴趣的:(运维,centos,ansible)