2016-05-25 5 views
0

Ich kann nicht ios_command-Modul in Ansible 2.1 zum Ausführen von Befehlen auf meinem Cisco-Router.Ansible 2.2 Cisco ios-Module sind mit der Meldung fehlgeschlagen "fehlgeschlagen Verbindung zum Host über ssh"

Ich habe ein Playbook zum Testen von ios_command-Modul auf Cisco-Routern geschrieben.

Im Anschluss an das Textbuch I

schrieb
--- 
    - hosts: router2 

    tasks: 

    - ios_command: 

     username: cisco 

     password: cisco 

#   host: router2.3node.example.com 

     commands: 

      - show version 

     register: output 

    - debug: msg="Hello World! {{ output.stdout }}" 

Aber das Textbuch schlägt mit der folgenden Meldung:

fatal: [router2.3node.example.com]: UNREACHABLE! => {"changed": false, 
"msg": "Failed to connect to the host via ssh.", "unreachable": true} 

und Wert unreachable=1

Auch die Ausgabe während des Laufens auf den Debug-Modus finden:

TASK [setup] 
******************************************************************* 

Using module file /home/cisco/ansible_dev/ansible/lib/ansible/modules 
/core/system/setup.py 

<router2.3node.example.com> ESTABLISH SSH CONNECTION FOR USER: None 

<router2.3node.example.com> SSH: EXEC ssh -C -q -o ControlMaster=auto 
-o ControlPersist=60s -o KbdInteractiveAuthentication=no -o 
PreferredAuthentications=gssapi-with-mic,gssapi- 
keyex,hostbased,publickey -o PasswordAuthentication=no -o 
ConnectTimeout=10 -o ControlPath=/home/cisco/.ansible/cp/ansible- 
ssh-%h-%p-%r router2.3node.example.com '/bin/sh -c '"'"'(umask 77 && 
mkdir -p "` echo $HOME/.ansible/tmp/ansible- 
tmp-1464109982.9-18150317646623 `" && echo ansible- 
tmp-1464109982.9-18150317646623="` echo $HOME/.ansible/tmp/ansible- 
tmp-1464109982.9-18150317646623 `") && sleep 0'"'"'' 



fatal: [router2.3node.example.com]: UNREACHABLE! => {"changed": false, "msg": "Failed to connect to the host via ssh.", "unreachable": true} 

Bitte lassen Sie mich wissen, wenn jemand das gleiche versucht und dieses Problem gelöst hat.

Antwort

2

bitte versuchen Sie es folgenden zwei Zeilen in Ihrem Textbuch hinzufügen:

 
    gather_facts: no 
    connection: local 
Verwandte Themen