我的几个报错:
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 就行了。
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步