Use raw module to install python-simplejson

850 views
Skip to first unread message

grobs

unread,
May 14, 2014, 6:48:26 AM5/14/14
to ansible...@googlegroups.com
Hi,

I'm trying to use the raw module in a plybook in order to install python-simplejson and python-apt modules on my nodes.
I saw that there already is a topic on this https://github.com/ansible/ansible/issues/4079 but I don't really understand the final point of that.

Here is my playbook:

---
- hosts: preprod_inventory_by_hand
  remote_user
: root
  tasks
:
   
- name: Installs python-simplejson in RAW mode
      raw
: apt-get -y install python-simplejson
     
register: apt_messages
   
- debug: var=apt_messages

Here is how I launch my playbook:

# ansible-playbook raw_install_base_modules.yml --private-key /my/super/ssl/key

And this is what it displays:

PLAY [preprod_inventory_by_hand] **********************************************

GATHERING FACTS ***************************************************************
Enter passphrase for key '/my/super/key':
failed: [10.11.11.11] => {"failed": true, "parsed": false}
invalid output was: Traceback (most recent call last):
  File "/root/.ansible/tmp/ansible-tmp-1400063672.79-16871822868352/setup", line 98, in <module>
    import simplejson as json
ImportError: No module named simplejson


TASK: [Installs python-simplejson in RAW mode] ********************************
FATAL: no hosts matched or all hosts have already failed -- aborting


PLAY RECAP ********************************************************************
10.66.237.161              : ok=0    changed=0    unreachable=0    failed=1


Please help :)
Tom



Serge van Ginderachter

unread,
May 14, 2014, 6:57:42 AM5/14/14
to ansible...@googlegroups.com
By default, the setup module is automatically run, which relies on json...
Add 'gather_facts: False' in the play header here to avoid that.


--
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.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/7b14b809-1f2b-4bde-8465-b019d73c5f92%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Brian Coca

unread,
May 14, 2014, 8:19:38 AM5/14/14
to ansible...@googlegroups.com
you might wan't to add a -q there:

apt-get -qy install python-simplejson

grobs

unread,
May 15, 2014, 5:02:54 AM5/15/14
to ansible...@googlegroups.com
Thank you all!
Ansible roxx !

Serge van Ginderachter

unread,
May 15, 2014, 5:25:09 AM5/15/14
to ansible...@googlegroups.com

On 15 May 2014 11:02, grobs <tom.l...@gmail.com> wrote:
Ansible roxx !

​Actually, it moos!​

Reply all
Reply to author
Forward
0 new messages