我是Ansible的新手。我使用Vagrant设置了一个Ubuntu虚拟机。我可以通过ssh vagrant@172.16.23.228命令登录到虚拟机。我已经创建了一个具有与vm相同密码的ssh密钥,并将其添加到代理中,并在我的hosts文件中指定了路径。
按照这里的说明后,当运行此命令(ansible all --inventory-file=hosts.ini --module-name ping -u vagrant -vvvv)时,我开始收到以下错误:
不确定我缺少什么配置,还需要检查什么?
按照这里的说明后,当运行此命令(ansible all --inventory-file=hosts.ini --module-name ping -u vagrant -vvvv)时,我开始收到以下错误:
不确定我缺少什么配置,还需要检查什么?
<172.16.23.228> ESTABLISH CONNECTION FOR USER: vagrant
<172.16.23.228> REMOTE_MODULE ping
<172.16.23.228> EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/Users/user/.ansible/cp/ansible-ssh-%h-%p-%r" - o Port=22 -o IdentityFile="~Users/user/.ssh/onemachine_rsa" -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=vagrant -o ConnectTimeout=10 172.16.23.228 /bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1451080871.59-247915080664557 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1451080871.59-247915080664557 && echo $HOME/.ansible/tmp/ansible-tmp-1451080871.59-247915080664557'
172.16.23.228 | FAILED => SSH Error: tilde_expand_filename: No such user Users
while connecting to 172.16.23.228:22
It is sometimes useful to re-run the command using -vvvv, which prints SSH debug output to help diagnose the issue.
My hosts file looks like:
[testserver]
172.16.23.228 ansible_ssh_port=22 ansible_ssh_user=vagrant ansible_ssh_private_key_file=~Users/user/.ssh/onemachine_rsa