SSH password:python
192.168.24.15 | FAILED >> {linux
"failed": true,json
"msg": "Error: ansible requires a json module, nonefound!",tomcat
"parsed": false服務器
}ssh
解決:python版本太低,要不升級python要不就安裝python-simplejsonide
2、安裝完成後鏈接客戶端服務器報錯:ui
FAILED => Using a SSH password insteadof a key is not possible because Host Key checking is enabled and sshpass doesnot support this. Please add this host'sfingerprint to your known_hosts file to manage this host.this
解決:在ansible 服務器上使用ssh 登錄下/etc/ansible/hosts 裏面配置的服務器。而後再次使用ansible 去管理就不會報上面的錯誤了!但這樣大批量登錄就麻煩來。由於默認ansible是使用key驗證的,若是使用密碼登錄的服務器,使用ansible的話,要不修改ansible.cfg配置文件的ask_pass = True給取消註釋,要不就在運行命令時候加上-k,這個意思是-k, --ask-pass ask for SSH password。再修改:host_key_checking= False便可spa
3、若是客戶端不在know_hosts裏將會報錯
paramiko: The authenticity of host '192.168.24.15'can't be established.
The ssh-rsa key fingerprint is397c139fd4b0d763fcffaee346a4bf6b.
Are you sure you want to continueconnecting (yes/no)?
解決:須要修改ansible.cfg的#host_key_checking= False取消註釋
4、出現FAILED => FAILED: not a valid DSA private key file
解決:須要你在最後添加參數-k
5、openssh升級後沒法登陸報錯
PAM unable todlopen(/lib64/security/pam_stack.so): /lib64/security/pam_stack.so: cannot openshared object
file: No such file or directory
解決:sshrpm 升級後會修改/etc/pam.d/sshd 文件。須要升級前備份此文件最後還原便可登陸。
6、pip安裝完成後,運行ansible報錯:
File "/usr/lib64/python2.6/subprocess.py",line 642, in __init__ errread, errwrite)
解決:安裝:yum installopenssh-clients
7、第一次系統初始化運行生成本機ansible用戶key時報錯
failed: [127.0.0.1] =>{"checksum": "f5f2f20fc0774be961fffb951a50023e31abe920","failed": true}
msg: Aborting, target uses selinux butpython bindings (libselinux-python) aren't installed!
FATAL: all hosts have already failed –aborting
解決:# yuminstall libselinux-python -y
8、ansible沒法起停tomcat的時候,有兩個點須要關注
(1)環境變量,在startup.sh中添加source /etc/profile
(2)後臺運行,加上nohup &