ansible--我的幾個報錯


 

我的幾個報錯:

1.遠程復制失敗

[root@localhost ~ ]#scp -r .ssh 192.168.10.145:/root/  

root@192.168.10.145's password:

bash: scp: command not found

lost connection

 

解決思路:發現沒裝openssh-clients客戶端工具

[root@centos6 ~ ]#rpm -qa openssh*

openssh-5.3p1-122.el6.x86_64

openssh-server-5.3p1-122.el6.x86_64

[root@centos6 ~ ]#yum install openssh-clients

 

 

3.
[root@ansible /etc/ansible ]#ansible-playbook -C nginx.yml
[WARNING]: While constructing a mapping from /etc/ansible/roles/nginx/tasks/main.yml, line 6, column 3, found a duplicate dict key (template). Using
last defined value only.

 

[WARNING]: Ignoring invalid attribute: with_item

 


4.
fatal: [192.168.10.145]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'item' is undefined\n\nThe error appears to have been in '/etc/ansible/roles/nginx/handlers/main.yml': line 1, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: reload the service\n ^ here\n"}
fatal: [192.168.10.144]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'item' is undefined\n\nThe error appears to have been in '/etc/ansible/roles/nginx/handlers/main.yml': line 1, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: reload the service\n ^ here\n"}

 

 

裝這幾個工具是方便-鍵操作

yum install ntpdate -y

ansible all -a 'yum install ntpdate -y'

ansible all -a '/usr/sbin/ntpdate stdtime.gov.hk'

ansible all -a 'yum install tree -y'

ansible all -a 'yum install openssh-clients -y'

 

2.同步失敗

[root@centos7 ~ ]#ansible all -a 'ntpdate time.nist.gov'

192.168.10.144 | FAILED | rc=1 >>

 5 May 19:00:00 ntpdate[37327]: no server suitable for synchronization foundnon-zero return code

解決方法:

第1:先要確定,系統確實可以上網,ping baidu.com 能通就行

第2:/usr/sbin/ntpdate stdtime.gov.hk 就行了


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM