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
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
23 janvier 2018 13:07 “Jayashri Garud” <jayashrigarud158@gmail.com> a écrit:
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
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
Sorry JYL. I posted it wrongly. It is actually
- name: deploy script_name script
command: /path/to/script/script_name.sh
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
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