Error: ansible requires a json module, none found!

10,302 views
Skip to first unread message

Dmitry Makovey

unread,
Jun 28, 2013, 11:46:11 AM6/28/13
to ansible...@googlegroups.com
Hi I searched google and only found https://groups.google.com/forum/#!topic/ansible-project/VvsonX7QrMk that deals with the similar problem. 

My problem is:

I'm using RHEL6 as my main ansible station (ansible-1.1 from EPEL) and whenever I launch it against RHEL5 boxes I get:

$ ansible rhe5box.com -i my-serverlist -u root -m command -a "ls"
rhel5box.com | FAILED >> {
    "failed": true, 
    "msg": "Error: ansible requires a json module, none found!", 
    "parsed": false
}
$ ssh ro...@rhel5box.com python -V
Python 2.4.3

Sounds like Ansible shouldn't care for json on remote boxes but for some reason it does - something I'm missing?

Michael DeHaan

unread,
Jun 28, 2013, 12:14:02 PM6/28/13
to ansible...@googlegroups.com
Sure, you need to install simplejson on the RHEL 5 boxes.

you can get this from EPEL, or alternatively, use the 'raw' module in Ansible to SSH in at a low level and execute a yum install of the URL to the python-simplejson RPM.




--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Patrick Regan

unread,
Jun 28, 2013, 12:16:09 PM6/28/13
to ansible...@googlegroups.com
Ansible requires python-simplejson being installed on EL boxes < 6. This is how modules can pass information back and forth (roughly).

You can bootstrap all your EL 5 boxes with this command:

ansible rhe5box.com -i my-serverlist -u root -m raw -a"yum install -y python-simplejson"

After that, ansible should work as advertised. This trick is hinted at in the requirements docs here: http://www.ansibleworks.com/docs/gettingstarted.html#requirements

But more detail can be seen here: http://www.ansibleworks.com/docs/modules.html#raw

A case could be made that this explicit issue should be talked about more clearly in the docs. Michael I know takes pull requests on Github. If not, filing an issue on Github might get you somewhere.


--
Patrick Regan
Phone: (330) 576-4044


On Fri, Jun 28, 2013 at 11:46 AM, Dmitry Makovey <droop...@gmail.com> wrote:

--

Ann Sybille Peters

unread,
Jun 28, 2013, 12:22:32 PM6/28/13
to ansible...@googlegroups.com
I had this problem too with RHEL. I think there is a RPM simplejson or so. Try that.

also sprach Dmitry Makovey <droop...@gmail.com> [2013.06.28.1746 +0200]:

Dmitry Makovey

unread,
Jun 28, 2013, 12:46:42 PM6/28/13
to ansible...@googlegroups.com
Thanks Patrick. That explains the issue. This is a bit unfortunate since it does put *some* requirement for target system to be "compatible" with ansible whereas my impression was that ansible is "batteries included" kind of approach. However I'll have to admit that single package shouldn't be that much of an issue.

Dmitry Makovey

unread,
Jun 28, 2013, 12:52:54 PM6/28/13
to ansible...@googlegroups.com
FYI found simplejson to be shipped directly from RHN:

yum info python-simplejson
Loaded plugins: cpacman_yum, rhnplugin, security
Available Packages
Name       : python-simplejson
Arch       : i386
Version    : 2.0.9
Release    : 8.el5
Size       : 140 k
Repo       : rhel-i386-server-5
Summary    : Simple, fast, extensible JSON encoder/decoder for Python
License    : MIT
Description: simplejson is a simple, fast, complete, correct and extensible JSON
           : <http://json.org> encoder and decoder for Python 2.4+.  It has no
           : external dependencies.
           : 
           : simplejson was formerly known as simple_json, but changed its name to
           : comply with PEP 8 module naming guidelines.
           : 
           : The encoder may be subclassed to provide serialization in any kind of
           : situation, without any special support by the objects to be serialized
           : (somewhat like pickle).
           : 
           : The decoder can handle incoming JSON strings of any specified encoding
           : (UTF-8 by default).

Patrick Regan

unread,
Jun 28, 2013, 1:02:57 PM6/28/13
to ansible...@googlegroups.com

On Fri, Jun 28, 2013 at 12:46 PM, Dmitry Makovey <droop...@gmail.com> wrote:
Thanks Patrick. That explains the issue. This is a bit unfortunate since it does put *some* requirement for target system to be "compatible" with ansible whereas my impression was that ansible is "batteries included" kind of approach. However I'll have to admit that single package shouldn't be that much of an issue.

I think the `raw` module takes care of this IMHO. The ability to bootstrap everything from ansible itself keeps it with the "batteries included" part. I too have a bunch of RHEL 5 boxes I am managing with Ansible. That single raw command got me up and running in less than 10 minutes. It took longer to read and understand it than it took to make it actually work.

जिज्ञेश भोगरे

unread,
Jun 2, 2014, 10:55:07 AM6/2/14
to ansible...@googlegroups.com
I encountered the same issue on my Ansible Host, when I try to run -m ping command to one of my linux server. After a detailed error information I got to know that ansible try to generate some files on client machine for that it requires "python-simplejson" available on the remote machine. After Installing the missing "python-simplejson" componant on remote machine I could able to run the command successfully.

-Jidnesh
Reply all
Reply to author
Forward
0 new messages