9

I am unable to figure out anymore on this as there's no way that I know of to get a "real" error message out of ansible. I run the below

$ ansible -i /opt/ansible/ec2.py "tag_Function_app:&tag_Application_pro:&tag_Environment_pqa"   --private-key=~/.ssh/id_root_rsa -m shell --sudo -a "service httpd restart" -u root 

But end up with a very nondescript error

10.221.142.0 | FAILED | rc=0 >>
MODULE FAILURE

What is exactly going on? Is there a way for me to further debug this? Trying to ssh strictly with the user / sshkey works fine?

ehime
  • 597
  • 2
  • 7
  • 15

5 Answers5

10

This error also occurs when Python 2.x is not installed in /usr/bin/python. E.g. on Ubuntu 16.04 you have to install it:

sudo apt -y update && sudo apt install -y python-minimal

See also the ansible docs.

Lars Bilke
  • 201
  • 2
  • 3
8

Answer is, the user did no have sudo perms. Thanks everyone =)

ehime
  • 597
  • 2
  • 7
  • 15
1

Disclaimer

In my case, it wasn't a sudo related problem. Posting for completion.

tl;dr

Don't use a virtualenv with two different versions of ansible (one in OS and the over in pip-virtualenv)

Explanation part

I had the same error with module "shell".

ansible -i ~/ansible-hosts example01 -mshell -a 'df -Ph' : MODULE FAILURE

ssh example01 'df -Ph' : no problem.

Problem

The version I had in my Debian (installed w/ aptitude) was 2.2.1.0 and the one in my Virtualenv (installed with pip from the Virtualenv) was 2.2.2.0.

Resolution

I uninstalled both and then re-installed the one in the Virtualenv.

hth

Boop
  • 113
  • 4
0

I installed ansible in a virtual env and played with galaxy roles and different names for them, this scrambled them somehow and lead to this error message. Deleted the virtual env and started new, everything fine again.

jan
  • 111
  • 3
0

This is unlikely to be the case for everyone, but I just experienced this error due to a full root volume on the affected hosts.

DevOops
  • 315
  • 4
  • 13
  • You shouldn't be posting this as an answer, but a comment ;) – ehime Aug 24 '18 at 19:44
  • 1
    It was the answer I didn't see here that I needed when I got a bunch of "MODULE FAILURE" output, hence its an answer not a comment. – DevOops Aug 27 '18 at 15:45