Command module failure- ansible

15 views
Skip to first unread message

Jayashri Garud

unread,
Jan 23, 2018, 7:06:31 AM1/23/18
to Ansible Project
Hi,
 I have a playbook for deployment . In which I have a task which execute script to extract artifacts. I am using jenkins server to run ansible. while running this playbook it is throwing error like "MODULE FAILURE".

deployment.yml

-  run deployment script
command:  /path/to/my/script/.sh

error:
FAILED! => {"changed": false, "failed": true, "module_stderr": "", "module_stdout": "", "msg": "MODULE FAILURE", "parsed": false}

ansible version -2.0.0

 

jean...@lenhof.eu.org

unread,
Jan 23, 2018, 7:30:20 AM1/23/18
to ansible...@googlegroups.com
Try this :
- name: run deployment script
command: /path/to/my/script/.sh

Explanations :
You forget to add "name" before describiing the action.... So ansible try to interpret "run" as a module
Be careful about indentations

Regards,

JYL

Jayashri Garud

unread,
Jan 23, 2018, 10:01:06 AM1/23/18
to ansible...@googlegroups.com
Sorry JYL. I posted it wrongly. It is actually

-  name: deploy script_name script
  command:  /path/to/script/script_name.sh




--
You received this message because you are subscribed to a topic in the Google Groups "Ansible Project" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ansible-project/6nEUY2Qfboo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ansible-project+unsubscribe@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/a115e58a4bf6968a6f500898763375a7%40wwws.lenhof.eu.org.

For more options, visit https://groups.google.com/d/optout.

J Hawkesworth

unread,
Jan 23, 2018, 12:41:38 PM1/23/18
to Ansible Project
It seems like that something that your script is doing is causing the command module to fail.  Without seeing the code for script_name.sh it is hard to make any useful suggestions about what is causing the failure.

Also its possible you need some environment variables set by your login shell, so you might need to be using 'shell' instead of command.

If possible I suggest breaking the script_name.sh into several separate scripts to help narrow down where it fails.

Hope this helps,

Jon
To unsubscribe from this group and all its topics, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.

Jayashri Garud

unread,
Jan 24, 2018, 8:45:43 AM1/24/18
to ansible...@googlegroups.com
Thank you Jon for suggesting this solution. I tried by breaking script_name.sh script into multiple scripts and all individual scripts running properly, it is not throwing module failure error now. And when I run a script_name.sh again ,it is throwing module failure error. The conclusion is there is no issue with script or module. I just want to tell one thing  that I observed .

We are using amazon ec2 instance(ubuntu) and from 2 days it is working slowly. And when I deploy script  to server, it is taking 10-12 minutes to execute script (before it was taking 2-3 minutes)and at one point process get halt and  jenkins server through error. I don't understand why it is happening, but I applied your solutions and it is working.

Thank you Jon



Regards,
Jayashri 

To unsubscribe from this group and all its topics, send an email to ansible-project+unsubscribe@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/7436be60-c1c4-407b-80ac-cb65b4609771%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages