vagrant ansible以下设置不存在:inventory_file

use*_*938 10 vagrant osx-mountain-lion ansible

我已经删除了一个git repo并且运行了vagrant但是我收到了这个错误消息

The following settings don't exist: inventory_file
Run Code Online (Sandbox Code Playgroud)

我已经为osx山狮安装了虚拟盒子和流浪汉和ansible.

但我无法得到任何工作.

还当我跑ansible all -m ping -vvvv我得到

<192.168.0.62> ESTABLISH CONNECTION FOR USER: Grant
<192.168.0.62> EXEC ['ssh', '-tt', '-vvv', '-o', 'ControlMaster=auto', '-o', 'ControlPersist=60s', '-o', 'ControlPath=/Users/Grant/.ansible/cp/ansible-ssh-%h-%p-%r', '-o', 'Port=22', '-o', 'KbdInteractiveAuthentication=no', '-o', 'PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey', '-o', 'PasswordAuthentication=no', '-o', 'ConnectTimeout=10', '192.168.0.62', "/bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-1379790346.17-244145524385544 && chmod a+rx $HOME/.ansible/tmp/ansible-1379790346.17-244145524385544 && echo $HOME/.ansible/tmp/ansible-1379790346.17-244145524385544'"]
192.168.0.62 | FAILED => SSH encountered an unknown error. The output was:
OpenSSH_5.9p1, OpenSSL 0.9.8y 5 Feb 2013
debug1: Reading configuration data /etc/ssh_config
debug1: /etc/ssh_config line 20: Applying options for *
debug1: auto-mux: Trying existing master
debug1: Control socket "/Users/Grant/.ansible/cp/ansible-ssh-192.168.0.62-22-Grant" does not exist
debug2: ssh_connect: needpriv 0
debug1: Connecting to 192.168.0.62 [192.168.0.62] port 22.
debug2: fd 3 setting O_NONBLOCK
debug1: connect to address 192.168.0.62 port 22: Operation timed out
ssh: connect to host 192.168.0.62 port 22: Operation timed out
Run Code Online (Sandbox Code Playgroud)

任何有关正在发生的事情的想法将不胜感激:)

jab*_*lab 11

对于该inventory_file问题,请尝试更改Vagrantfile以使用inventory_path.我认为Vagrant 1.3.x发生了这种微妙的变化.如果您不想Vagrantfile使用Vagrant 1.2.x 修改try.

运行时:

ansible all -m ping -vvvv
Run Code Online (Sandbox Code Playgroud)

这将使用您当前的用户,并查看Ansible主机库存(/etc/ansible/hosts)的默认位置.

为了使其与Vagrant定义的VM一起使用,您需要使用该vagrant用户,指定在连接期间使用的SSH密钥并指定主机库存的位置,例如

ansible all \
  -i provisioning/inventory # <-- or wherever the inventory is \ 
  -m ping \
  -u vagrant \
  --private-key ~/.vagrant.d/insecure_private_key
Run Code Online (Sandbox Code Playgroud)