Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error: ansible requires a json module, none found

Tags:

json

ansible

Error while executing ansible ping module

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
}

This is my inventory file

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

I have installed simplejosn module also in the client as well as remote machine

bash ~ pip list | grep json
simple-json (1.1)
simplejson (3.6.5)
like image 452
anish Avatar asked Feb 07 '15 09:02

anish


1 Answers

I think you need to install the python-simplejson module.

Try to run this command first and then your desired commands:

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

I am supposing that its old Red Hat/CentOS system.

like image 165
Arbab Nazar Avatar answered Nov 15 '22 20:11

Arbab Nazar