2015-02-07 19 views
10

errore durante l'esecuzione ansible modulo pingErrore: ansible richiede un modulo JSON, nessuno ha trovato

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 
} 

Questo è il mio file di inventario

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

Ho installato il modulo simplejosn anche nel client così come macchina remota

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

Eventuali duplicati di [Ansible + 10.11.6] (http://stackoverflow.com/questions/3879 9807/ansible-10-11-6) – zabeltech

risposta

15

Penso che sia necessario installare il modulo python-simplejson.

tenta di eseguire questo comando prima e poi i comandi desiderati:

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

sto supponendo che il suo vecchio sistema Red Hat/CentOS.

9

Se non si vuole o non si può installare il modulo python-simplejson su server remoti, si può semplicemente richiedere l'output grezzo invece:

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

O come ho fatto, aggiunto alla mia ~ /.bash_profile

alias ansible="ansible -m raw" 

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

in CentOS 5. * versione no json python-semplice disponibile sul repo per donwload e installare. puoi usare semplicemente il metodo sotto menzionato.

Assicurarsi che sia l'origine sia la destinazione debbano accedere a una password inferiore e dalla sorgente alla destinazione anche la password meno.

uso ssh-keygen -t rsa per generare chiave ssh-copy-id user @ host_ip

"--- - host: (host ansible) diventano: sì utente_remoto: root gather_facts: falsi compiti: - nome: la copia di copia temps shell: ssh (fonte) & & rsync -parv/root/temp/* root @ (Destinazione):/root/temp /"

Problemi correlati