这是我的inventory.ini
文件:
[workers]
host_alias ansible_ssh_host=123.123.123.123
[workers:vars]
ansible_ssh_user=root
ansible_ssh_port=22
ansible_ssh_private_key_file=my_folder/id_rsa
ansible_ssh_pass=password
当我ansible all -i inventory.ini -m ping
时,我什么也没得到,没有错误,屏幕挂起。当我将用户更改为root以外的某些东西时,我会被拒绝许可:
host_alias UNREACHABLE! => {
"changed": false,
"msg": "Failed to connect to the host via ssh: Permission denied (publickey).\r\n",
"unreachable": true
}
但是,如果我执行ssh -i文件root@123.123.123.123,系统会提示我输入私钥密码。如果我做同样但非root用户,我得到:
Permission denied (publickey).
更新:ANSIBLE_DEBUG=1
给了我,作为永久悬挂之前的最后一个命令:
_low_level_execute_command(): executing: /bin/sh -c '( umask 77 && mkdir -p "` echo ~/.ansible/tmp/ansible-tmp-1488620620.62-50272535751653 `" && echo ansible-tmp-1488620620.62-50272535751653="` echo ~/.ansible/tmp/ansible-tmp-1488620620.62-50272535751653 `" ) && sleep 0'
答案 0 :(得分:0)
事实证明ansible_ssh_pass=password
特定于密码连接,不能用作私钥的密码。拿出来解决了这个问题,但我必须手动输入