1、Failed to connect to the host via ssh: Permission denied 权限拒绝
没有ssh秘钥认证。
ansible是基于ssh秘钥认证的,估生成秘钥,重新分发下公钥就ok了
[root@m01 /server/ansible-playbook]# ansible-playbook -C ansible-var01.yml
PLAY [oldboy] ************************************************************************************************************************
TASK [Gathering Facts] ***************************************************************************************************************
fatal: [172.16.1.41]: UNREACHABLE! => {"changed": false, "msg": "Failed to connect to the host via ssh: Permission denied (publickey,password).", "unreachable": true}
fatal: [172.16.1.31]: UNREACHABLE! => {"changed": false, "msg": "Failed to connect to the host via ssh: Permission denied (publickey,password).", "unreachable": true}
PLAY RECAP ***************************************************************************************************************************
172.16.1.31 : ok=0 changed=0 unreachable=1 failed=0 skipped=0 rescued=0 ignored=0
172.16.1.41 : ok=0 changed=0 unreachable=1 failed=0 skipped=0 rescued=0 ignored=0
[root@m01 /server/ansible-playbook]#
2、The task includes an option with an undefined variable 任务包含一个带有未定义变量的选项
根据错误的行数提醒,shell模块的命令书写错误
TASK [make dir] **********************************************************************************************************************
fatal: [172.16.1.41]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'dict object' has no attribute 'stdout'\n\nThe error appears to be in '/server/ansible-playbook/ansible-var04.yml': line 12, column 7, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n register: time\n - name: make dir\n ^ here\n"}
fatal: [172.16.1.31]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'dict object' has no attribute 'stdout'\n\nThe error appears to be in '/server/ansible-playbook/ansible-var04.yml': line 12, column 7, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n register: time\n - name: make dir\n ^ here\n"}
网友评论