《LINUX學(xué)習(xí):RHEL 6.6下安裝Ansible》要點(diǎn):
本文介紹了LINUX學(xué)習(xí):RHEL 6.6下安裝Ansible,希望對(duì)您有用。如果有疑問(wèn),可以聯(lián)系我們。
ansible是新出現(xiàn)的自動(dòng)化運(yùn)維工具,基于Python開發(fā),集合了眾多運(yùn)維工具(puppet、cfengine、chef、func、fabric)的長(zhǎng)處,實(shí)現(xiàn)了批量系統(tǒng)配置、批量程序部署、批量運(yùn)行命令等功能.(百度百科),2015年RedHat收購(gòu)ansible.
主機(jī)情況:
OS:Red Hat Enterprise Linux Server release 6.6 (Santiago) x86_64
IP:172.16.10.180
Python 2.6.6
注:操作體系最小化安裝
節(jié)點(diǎn):
OS:Oracle Linux Server release 5.8
IP:172.16.10.10、172.16.10.200
Python 2.4.3
1、安裝開發(fā)對(duì)象:
# yum -y groupinstall "Development tools"
2、安裝six、yaml
# rpm -ivh python-six-1.9.0-1.el6.pp.noarch.rpm?
# rpm -ivh python-yaml-3.09-3.el6.rf.x86_64.rpm
3、安裝ansible
# yum install ansible
注:受控節(jié)點(diǎn)必要安裝python-simplejson
4、天生秘鑰文件
# ./sshUserSetup.sh -user root -hosts "172.16.10.10 172.16.10.200"
輸入yes和兩臺(tái)主機(jī)的root暗碼即可完成172.16.10.180->172.16.10.10、172.16.10.180->172.16.10.200的驗(yàn)證
?
或者:
# ssh-keygen -t rsa -P ''
在/root/.ssh/下生成文件id_rsa.pub,拷貝到所有受控機(jī)并執(zhí)行以下操作:
# cat /root/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys
# chmod 600 /root/.ssh/authorized_keys
5、改動(dòng)hosts文件
# cd /etc/ansible/
# cat /etc/ansible/hosts
...
[dbservers]
172.16.10.10
172.16.10.200
6、改動(dòng)ansible.cfg文件
# cat /etc/ansible/ansible.cfg
...
remote_port = 36000
...
private_key_file = /root/.ssh/id_rsa
7、測(cè)試
# ansible all? -m ping
# all指所有定的主機(jī)
172.16.10.10 | SUCCESS => {
? ? "changed": false,?
? ? "ping": "pong"
}
172.16.10.200 | SUCCESS => {
? ? "changed": false,?
? ? "ping": "pong"
}
?
# ansible dbservers -m ping? ? ?
172.16.10.200 | SUCCESS => {
? ? "changed": false,?
? ? "ping": "pong"
}
172.16.10.10 | SUCCESS => {
? ? "changed": false,?
? ? "ping": "pong"
}
8、常見(jiàn)差錯(cuò):
A、"msg": "Error: ansible requires the stdlib json or simplejson module, neither was found!"
受控端必要安裝python-simplejson
?
B、FAILED => module command not found in configured module paths. Additionally, core modules are missing. If this is a checkout, run 'git submodule update --init --recursive' to correct this problem.
安裝過(guò)程有問(wèn)題,重新安裝
?
C、FAILED => to use the 'ssh' connection type with passwords, you must install the sshpass program
安裝sshpass
下面關(guān)于Ansible的文章您也可能喜歡,不妨參考下:
CentOS下部署Ansible自動(dòng)化對(duì)象?
在 CentOS 7 中安裝并使用自動(dòng)化對(duì)象 Ansible?
CentOS 7上搭建Jenkins+Ansible服務(wù)?
Linux下源碼編譯安裝Ansible及排錯(cuò)記載?
Ansible根基—安裝與常用模塊?
Ansible設(shè)置裝備擺設(shè)及使用?
自動(dòng)化運(yùn)維對(duì)象之 Ansible 介紹及安裝使用?
自動(dòng)化運(yùn)維之Ansible詳解?
Ansible入門notify和handlers?
CentOS 6.5安裝自動(dòng)化對(duì)象Ansible和圖形化對(duì)象Tower?
Ansible 的詳細(xì)先容:請(qǐng)點(diǎn)這里
Ansible 的下載地址:請(qǐng)點(diǎn)這里
本文永遠(yuǎn)更新鏈接地址:
歡迎參與《LINUX學(xué)習(xí):RHEL 6.6下安裝Ansible》討論,分享您的想法,維易PHP學(xué)院為您提供專業(yè)教程。
轉(zhuǎn)載請(qǐng)注明本頁(yè)網(wǎng)址:
http://www.fzlkiss.com/jiaocheng/9056.html