2013-09-21 3 views
10

inventory_file 나는 자식의 repo를 아래로 당겨 최대 방랑 실행하지만 난 가상 상자와 방랑과를 설치 한방랑 ansible 다음 설정은 존재하지 않습니다

The following settings don't exist: inventory_file 

이 오류 메시지를 받고 있어요했습니다 osx 산 사자를위한.

하지만 아무것도 작동하지 않습니다. 내가 ansible all -m ping -vvvv을 실행할 때

도 나는 inventory_file 문제에 대한

<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 

모든 이해 될 것이다 무슨 일이 일어나고 있는지에 대한 아이디어 :

답변

11

대신 inventory_path를 사용하도록 Vagrantfile을 변경하려고 얻을. 이 미묘한 변화는 Vagrant 1.3.x에서 발생했다고 생각합니다. Vagrantfile을 수정하지 않으려면 Vagrant 1.2.x를 사용해보십시오.

하여 실행하는 경우 :

ansible all -m ping -vvvv 

이 현재 사용자를 사용하고 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 
0
$ ansible all -i inventory -m ping -u vagrant --private-key ~/.vagrant.d/insecure_private_key 
ansible_ssh_private_key_file=/Users/dxiao/.vagrant.d/insecure_private_key | FAILED => SSH encountered an unknown error during the connection. We recommend you re-run the command using -vvvv, which will enable SSH debugging output to help diagnose the issue 
ansible_ssh_user=vagrant | FAILED => SSH encountered an unknown error during the connection. We recommend you re-run the command using -vvvv, which will enable SSH debugging output to help diagnose the issue 
testserver | success >> { 
    "changed": false, 
    "ping": "pong" 
} 

$ cat inventory 
testserver ansible_ssh_host=127.0.0.1 ansible_ssh_port=2222 
ansible_ssh_user=vagrant 
ansible_ssh_private_key_file=/Users/dxiao/.vagrant.d/insecure_private_key 

작동합니다.

3

~/.vagrant.d/insecure_private_key을 사용하여 블록 전체에서 반복되었지만 Vagrantfile 인 경로에서 실제로는 .vagrant/machines/default/virtualbox/private_key을 사용하고있는 것으로 나타났습니다. 그들은 아마도 키 생성을 사용자 단위가 아닌 기계 단위로 변경했지만 설명서에는 아직 반영되지 않았습니다.

그래서 전체 명령, 그것은 다음과 같습니다

ansible-playbook -i .vagrant/provisioners/ansible/inventory/vagrant_ansible_inventory --private-key=.vagrant/machines/default/virtualbox/private_key -u vagrant playbook.yml

당신은 하나 vagrant ssh-config을 실행하고 IdentityFile 가치를 찾아 다른 여부를 확인할 수 있습니다.