2015-02-07 11 views
10

Fehler beim ansible Ping-Modul AusführungFehler: ansible ein json-Modul benötigt, fand keine

bash ~ ansible webservers -i inventory -m ping -k -u root -vvvv 
SSH password: 
<~> ESTABLISH CONNECTION FOR USER: root on PORT 22 TO ~ 
<my-lnx> ESTABLISH CONNECTION FOR USER: root on PORT 22 TO my-lnx 
~ | FAILED => FAILED: [Errno 8] nodename nor servname provided, or not known 
<my-lnx> REMOTE_MODULE ping 
<my-lnx> EXEC /bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1423302966.66-77716810353582 && echo $HOME/.ansible/tmp/ansible-tmp-1423302966.66-77716810353582' 
<my-lnx> PUT /var/folders/8n/fftvnbbs51q834y16vfvb1q00000gn/T/tmpP6zwZj TO /root/.ansible/tmp/ansible-tmp-1423302966.66-77716810353582/ping 
<my-lnx> EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1423302966.66-77716810353582/ping; rm -rf /root/.ansible/tmp/ansible-tmp-1423302966.66-77716810353582/ >/dev/null 2>&1' 
my-lnx | FAILED >> { 
    "failed": true, 
    "msg": "Error: ansible requires a json module, none found!", 
    "parsed": false 
} 

Dies ist mein Inventar Datei

bash ~ cat inventory 
[webservers] 
my-lnx ansible_ssh_host=my-lnx ansible_ssh_port=22 

I simplejosn Modul auch in dem Client installiert haben, sowie Remote-Maschine

bash ~ pip list | grep json 
simple-json (1.1) 
simplejson (3.6.5) 
+0

Mögliche Duplikat [ansible + 10.11.6] (http://stackoverflow.com/questions/3879 9807/ansible-10-11-6) – zabeltech

Antwort

15

Ich denke, dass Sie das Modul python-simplejson installieren müssen.

Versuchen Sie diesen Befehl zuerst auszuführen und dann den gewünschten Befehle:

ansible webservers -i inventory -m raw -a "sudo yum install -y python-simplejson" -k -u root -vvvv 

ich, dass seine alten Red Hat/CentOS System werde angenommen.

9

Wenn Sie nicht wollen oder können die Python-simplejson Modul auf Remote-Servern nicht installiert haben, können Sie einfach fordern Sie die Rohausgangssignal statt:

> ansible webservers -i inventory -m ping -m raw 

Oder wie ich, es zu meiner ~ /.bash_profile

alias ansible="ansible -m raw" 

# And then simply running: 
> ansible webservers -i inventory -m ping 
1

in centOS 5. * Version keine python-simple json auf Repo zur Verfügung donwload und zu installieren. Sie können die unten erwähnte Methode einfach verwenden.

stellen Sie sicher, dass sowohl auf die Quelle und das Ziel sollte Passwort weniger und von der Quelle zum Ziel auch Passwort weniger zugegriffen werden.

Verwendung ssh-keygen -t rsa Schlüssel ssh-copy-id user @ host_ip

„--- zu erzeugen - Gastgeber: (ansible Host) werden: ja remote_user: root gather_facts: falsche Aufgaben: - Name: Kopieren Kopieren temps Shell: ssh (Quelle) & & rsync -parv/root/temp/* root @ (Ziel):/root/temp /“

Verwandte Themen