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"
}
在使用過程中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/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- AWK高階應用
- Redis 高階應用Redis
- ansible高階操作 serial滾動更新
- React 高階應用 -- 高階元件 Heigher Order ComponentReact元件
- 「Mybatis系列」Mybatis高階應用MyBatis
- 02 . Ansible高階用法(運維開發篇)運維
- LVS高階應用-會話保持會話
- Docker 運維高階應用管理Docker運維
- 用 Ansible 部署無服務應用!
- react 高階元件的 理解和應用React元件
- Hive 高階應用開發示例(一)Hive
- C++高階應用_設計模式C++設計模式
- 向量(高階的隨機化應用)隨機
- STM32F103 高階應用(2)——中斷應用
- 基於PostGIS的高階應用(5)–PolygonSplitingGo
- WinRAR初級中級高階等應用
- 分享Python的5種高階特徵應用Python特徵
- Spring AOP高階應用與原始碼剖析Spring原始碼
- Jenkins 使用指南 之 高階應用篇Jenkins
- ArkWeb頁面跳轉與跨應用導航 - 高階應用Web
- React 高階應用 -- 錯誤邊界 Error BoundariesReactError
- 說說 vue-router 元件的高階應用Vue元件
- React 中的高階元件及其應用場景React元件
- day16-物件導向高階和應用物件
- Nuget一鍵打包上傳以及高階應用
- MACD技術的高階應用--MACD與波浪Mac
- ArkWeb高階安全模式 - 提升應用安全性Web模式
- c# 高階應用 理解擴充套件方法C#套件
- Netty高階應用及聊天室實戰Netty
- 技術進階:Kubernetes高階架構與應用狀態部署架構
- oracle學習筆記(十七) PL/SQL高階應用Oracle筆記SQL
- 高階玩法之類的裝飾器的應用
- Tomcat高階配置(應用場景總結及示例)Tomcat
- Ansible 進階 | 動態 Inventory
- css高階應用三種方法實現多行省略CSS
- FTP-Vsftpd的高階應用:虛擬使用者FTP
- gojs 實用高階用法GoJS
- Excel高階應用教程:資料處理與資料分析Excel