10
votes

Vagrant Ansible Les paramètres suivants n'existent pas: inventaire_file

J'ai retiré un repo git et a couru vagabin, mais je reçois ce message d'erreur

<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


0 commentaires

4 Réponses :


11
votes

pour le inventaire_file code> Essayez de changer le VagrantFile code> pour utiliser inventaire_path code> à la place. Je pense que ce changement subtil est survenu avec Vagrant 1.3.x. Si vous ne voulez pas modifier le VagrantFile CODE> ESSAY Utilisez Vagrant 1.2.x.

Lorsque vous exécutez: P>

ansible all \
  -i provisioning/inventory # <-- or wherever the inventory is \ 
  -m ping \
  -u vagrant \
  --private-key ~/.vagrant.d/insecure_private_key


0 commentaires

0
votes

Au lieu de passer l'inventaire_file, privé_key et ssh_user à chaque fois, vous pouvez les mettre dans un fichier de configuration ansible. Voir ma réponse plus détaillée ici: https://stackoverflow.com/a/25316963/502457


0 commentaires

0
votes
$ 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
it works.

0 commentaires

3
votes

Il a été répété dans tout le bloc sur l'utilisation de ~ / / Code>, dans le chemin où le VagrantFile est. Ils ont probablement changé de génération de clé pour être par machine, non par l'utilisateur, mais la documentation ne reflète pas encore cela.

Donc pour toute la commande, ce serait:

ansible-playbook -Ivagrant / proviseurs / ansible / inventaire / VagrantT_ansible_inventory - Private-Key = .vaçade / Machines / par défaut / Virtualbox / Private_key -u Vagrant Playbook.yml

Vous pouvez vérifier si l'une ou l'autre en exécutant Vagrant SSH-config et recherchez le fichier identité valeur.


0 commentaires