I installed ansible on osx mountain lion but running a simple test gives me error…no idea what’s wrong i am doing
furqan@Furqans-MacBook-Pro { ~/ansible-config }-> ansible all -m ping -i ansible_hosts
192.168.50.10 | FAILED >> {
“failed”: true,
“msg”: “Traceback (most recent call last):\n File "/home/furqan/.ansible/tmp/ansible-1362161854.31-10504181979454/ping", line 860, in ?\n main()\n File "/home/furqan/.ansible/tmp/ansible-1362161854.31-10504181979454/ping", line 42, in main\n supports_check_mode = True\n File "/home/furqan/.ansible/tmp/ansible-1362161854.31-10504181979454/ping", line 186, in init\n (self.params, self.args) = self._load_params()\n File "/home/furqan/.ansible/tmp/ansible-1362161854.31-10504181979454/ping", line 639, in _load_params\n params2 = json.loads(MODULE_COMPLEX_ARGS)\nAttributeError: ‘module’ object has no attribute ‘loads’\n”,
“parsed”: false
}
furqan@Furqans-MacBook-Pro { ~/ansible-config }-> cd -
What kind of host are you talking to?
It looks like you just need to install simplejson because you are
talking to an older Python, though I agree the error message should be
better.
It’s installed … anything else that needs to be looked? Actually i have already tested it on rhel to rhel servers but now i am trying to do a local setup on my machine OSx to Vagrant-CentOS. Any known issues? been stuck for a while now
Source::
furqan@Furqans-MacBook-Pro { ~ }-> whereis python
/usr/bin/python
furqan@Furqans-MacBook-Pro { ~ }-> python --version
Python 2.7.2
furqan@Furqans-MacBook-Pro { ~ }->
Destination::
[furqan@vagrant-c5-x86_64 ~]$ whereis python
python: /usr/bin/python2.4 /usr/bin/python /usr/lib/python2.4 /usr/share/man/man1/python.1.gz
[furqan@vagrant-c5-x86_64 ~]$
[furqan@vagrant-c5-x86_64 ~]$ rpm -qa | grep json
python-simplejson-2.0.9-8.el5
python-json-3.4-3.el5
[furqan@vagrant-c5-x86_64 ~]$
If you run /usr/bin/python while logged into that box, and do "import
simplejson", what happens?
[furqan@vagrant-c5-x86_64 ~]$ /usr/bin/python
Python 2.4.3 (#1, Jan 9 2013, 06:47:03)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-54)] on linux2
Type “help”, “copyright”, “credits” or “license” for more information.
This is probably best debugged over IRC.
Make sure you don't have ansible_python_interpreter set to select a
python that doesn't have it, and you are talking to the right box.
for anyone else from future :: i had installed python-json alongside python-simplejson which was causing the problem.
So json is included in Python 2.6 and later (core)
Python-simplejson is the API compatible JSON implementation for 2.4x that has the same API.
What is python-json?
python-json is a bad library…I mistakenly installed both python-simplejson and python-json and ansible failed to work. So if you have both installed make sure to keep only python-simplejson to keep the thing working.