ansible高级应用ansible-vault

ansible-vault属于ansible高级应用。
在使用过程中ansible 1.9执行加密后的问题,提示错误;在ansible 2.5中可以运行,测试过程如下:

[root@DBA180321R00P ansible]# /usr/local/bin/ansible --version
ansible 1.9.0.1
  configured module search path = None


[root@GAOYCR00P ansible]# ansible --version
ansible 2.5.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible-2.5.0-py2.7.egg/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.5 (default, Oct 11 2015, 17:47:16) [GCC 4.8.3 20140911 (Red Hat 4.8.3-9)]
[root@GAOYCR00P ansible]# ansible-vault encrypt hosts
New Vault password: 
Confirm New Vault password: 
Encryption successful
[root@GAOYCR00P ansible]# more hosts
[Suse]
192.168.15.21 ansible_ssh_user=csuser ansible_ssh_pass=abcde123
192.168.15.22 ansible_ssh_user=csuser ansible_ssh_pass=abcde123
192.168.15.46 ansible_ssh_user=csuser ansible_ssh_pass=abcde123
192.168.15.47 ansible_ssh_user=csuser ansible_ssh_pass=abcde123
[plycs]
192.168.15.31  ansible_ssh_user=oracle ansible_ssh_pass=oracle
[root@GAOYCR00P ansible]# ansible Suse -m ping
192.168.15.46 | SUCCESS => {
    "changed": false, 
    "ping": "pong"
}
192.168.15.21 | SUCCESS => {
    "changed": false, 
    "ping": "pong"
}
192.168.15.22 | SUCCESS => {
    "changed": false, 
    "ping": "pong"
}
192.168.15.47 | SUCCESS => {
    "changed": false, 
    "ping": "pong"
}


[root@GAOYCR00P ansible]# ansible-vault decrypt hosts
Vault password: 
Decryption successful
[root@GAOYCR00P ansible]# ansible Suse -m ping --ask-vault-pass
Vault password: 
192.168.15.47 | SUCCESS => {
    "changed": false, 
    "ping": "pong"
}
192.168.15.22 | SUCCESS => {
    "changed": false, 
    "ping": "pong"
}
192.168.15.46 | SUCCESS => {
    "changed": false, 
    "ping": "pong"
}
192.168.15.21 | SUCCESS => {
    "changed": false, 
    "ping": "pong"
}
[root@GAOYCR00P ansible]# /usr/local/bin/ansible --version
ansible 1.9.0.1
  configured module search path = None
[root@GAOYCR00P ansible]# /usr/local/bin/ansible Suse -m ping --ask-vault-pass
Vault password: 
No hosts matched
[root@GAOYCR00P ansible]# ansible-vault decrypt hosts
Vault password: 
Decryption successful
[root@GAOYCR00P ansible]# more hosts
[Suse]
192.168.15.21 ansible_ssh_user=csuser ansible_ssh_pass=abcde123
192.168.15.22 ansible_ssh_user=csuser ansible_ssh_pass=abcde123
192.168.15.46 ansible_ssh_user=csuser ansible_ssh_pass=abcde123
192.168.15.47 ansible_ssh_user=csuser ansible_ssh_pass=abcde123
[plycs]
192.168.15.31  ansible_ssh_user=oracle ansible_ssh_pass=oracle
[root@GAOYCR00P ansible]# /usr/local/bin/ansible Suse -m ping
192.168.15.21 | success >> {
    "changed": false, 
    "ping": "pong"
}


192.168.15.22 | success >> {
    "changed": false, 
    "ping": "pong"
}


192.168.15.46 | success >> {
    "changed": false, 
    "ping": "pong"
}


192.168.15.47 | success >> {
    "changed": false, 
    "ping": "pong"
}

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/24585765/viewspace-2152177/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/24585765/viewspace-2152177/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值