2

I'm trying to begin using ansible, so I am walking thru an introduction. I've installed ansible on Debian Jessie, using apt-get. It displays version 2.2

I've configured /etc/ansible/hosts file like this:

test ansible_connection=local

If I run

ansible all -m ping

I get an optimistic result:

test | SUCCESS => { "changed": false, "ping": "pong" }

But as I try (as intro suggests) running the most primitive command possible:

ansible all -a "/bin/echo hello"

I get a very disappointing

An exception occurred during task execution. To see the full traceback, use -vvv. The error was: NameError: global name 'MODULE_ARGS' is not defined test | FAILED | rc=0 >> MODULE FAILURE

As I run it with -vvv, I get

Using /etc/ansible/ansible.cfg as config file
Using module file /usr/share/ansible/commands/command
<test> ESTABLISH LOCAL CONNECTION FOR USER: my-username
<test> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1464972944.68-67450526741064 `" && echo ansible-tmp-1464972944.68-67450526741064="` echo $HOME/.ansible/tmp/ansible-tmp-1464972944.68-67450526741064 `" ) && sleep 0'
<test> PUT /tmp/tmpTcFA7W TO /home/my-username/.ansible/tmp/ansible-tmp-1464972944.68-67450526741064/command
<test> EXEC /bin/sh -c 'chmod -R u+x /home/my-username/.ansible/tmp/ansible-tmp-1464972944.68-67450526741064/ && sleep 0'
<test> EXEC /bin/sh -c 'LANG=C LC_ALL=C LC_MESSAGES=C /usr/bin/python /home/my-username/.ansible/tmp/ansible-tmp-1464972944.68-67450526741064/command; rm -rf "/home/my-username/.ansible/tmp/ansible-tmp-1464972944.68-67450526741064/" > /dev/null 2>&1 && sleep 0'
An exception occurred during task execution. The full traceback is:
Traceback (most recent call last):
  File "/tmp/ansible_771nna/ansible_module_command.py", line 243, in <module>
    main()
  File "/tmp/ansible_771nna/ansible_module_command.py", line 117, in main
    module = CommandModule(argument_spec=dict())
  File "/usr/local/lib/python2.7/dist-packages/ansible-2.2.0-py2.7.egg/ansible/module_utils/basic.py", line 616, in __init__
    self._load_params()
  File "/tmp/ansible_771nna/ansible_module_command.py", line 204, in _load_params
    args = MODULE_ARGS
NameError: global name 'MODULE_ARGS' is not defined

test | FAILED | rc=0 >>
MODULE FAILURE

What am I doing wrong ? Thanks a lot!

1 Answer 1

3

Ok, in this case, it seems something was wrong during installation. I've done

sudo apt-get remove ansible

then

pip install ansible

and now the command above runs successfully!

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .