Ansible playbooks passes without any issues, when I run it directly from cli (also inside of Jenkins workspace)
But I receives the following error
"FAILED! => {“failed”: true, “msg”: “ERROR! the handler ‘juniper_junos_facts’ was not found”
when ansible runs by execution of Jenkins job.
juniper_junos_facts is the task of Juniper.junos role.
I have specifide library path in ansible configuration and exported ANSIBLE_LIBRARY variable.
Do you have any ideas, why ansible can not find tasks iside of Jenkins?
I’ve received the same error result with or without ansible plagin.
Here is the last jenkins output log with ansible plugin:
[Job_gitlab_ansible_2] $ /usr/bin/ansible-playbook test2.yml -i hosts -f 5 --private-key /tmp/ssh1443101965150836988.key -u root
PLAY [GET] *********************************************************************
TASK [CHECK-NETCONF] ***********************************************************
ok: [10.10.10.11]
TASK [Retrive information from devices running Junos OS] ***********************
fatal: [10.10.10.11]: FAILED! => {"failed": true, "msg": "ERROR! the handler 'juniper_junos_facts' was not found"}
PLAY RECAP *********************************************************************
10.10.10.11 : ok=1 changed=0 unreachable=0 failed=1
FATAL: command execution failed
hudson.AbortException: Ansible playbook execution failed
at org.jenkinsci.plugins.ansible.AnsiblePlaybookBuilder.perform(AnsiblePlaybookBuilder.java:236)
at org.jenkinsci.plugins.ansible.AnsiblePlaybookBuilder.perform(AnsiblePlaybookBuilder.java:207)
at hudson.tasks.BuildStepCompatibilityLayer.perform(BuildStepCompatibilityLayer.java:81)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:744)
at hudson.model.Build$BuildExecution.build(Build.java:206)
at hudson.model.Build$BuildExecution.doRun(Build.java:163)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:504)
at hudson.model.Run.execute(Run.java:1724)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:421)
ERROR: Ansible playbook execution failed
Finished: FAILURE
I’ve received the same error result with or without ansible plagin.
Here is the last jenkins output log with ansible plugin:
[Job_gitlab_ansible_2] $ /usr/bin/ansible-playbook test2.yml -i hosts -f 5 --private-key /tmp/ssh1443101965150836988.key -u root PLAY [GET] ********************************************************************* TASK [CHECK-NETCONF] *********************************************************** ok: [10.10.10.11] TASK [Retrive information from devices running Junos OS] *********************** fatal: [10.10.10.11]: FAILED! => {"failed": true, "msg": "ERROR! the handler 'juniper_junos_facts' was not found"} PLAY RECAP ********************************************************************* 10.10.10.11 : ok=1 changed=0 unreachable=0 failed=1 FATAL: command execution failed hudson.AbortException: Ansible playbook execution failed at org.jenkinsci.plugins.ansible.AnsiblePlaybookBuilder.perform(AnsiblePlaybookBuilder.java:236) at org.jenkinsci.plugins.ansible.AnsiblePlaybookBuilder.perform(AnsiblePlaybookBuilder.java:207) at hudson.tasks.BuildStepCompatibilityLayer.perform(BuildStepCompatibilityLayer.java:81) at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20) at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:744) at hudson.model.Build$BuildExecution.build(Build.java:206) at hudson.model.Build$BuildExecution.doRun(Build.java:163) at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:504) at hudson.model.Run.execute(Run.java:1724) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) at hudson.model.ResourceController.execute(ResourceController.java:97) at hudson.model.Executor.run(Executor.java:421) ERROR: Ansible playbook execution failed Finished: FAILURE
Possible is it required additional specifications in ansible.cfg?
But it works properly without jenkins.
Hi,
Where's your file ?
For the record ansible look for config file in this order :
* ANSIBLE_CONFIG (an environment variable)
* ansible.cfg (in the current directory)
* .ansible.cfg (in the home directory)
* /etc/ansible/ansible.cfg
All of this files also are located in jenkins workspace.
Just guessing… you need to do some make and try to make some progress in this issue you encounter :
Perhaps the default path is not the same if you call ansible-playbook from jenkins and from command line…
Are the files in the homedir of the user you use to execute ansible or in another directory ?
You have to try one or more of these things :
Did you try with absolute paths instead of relative in your ansible.cfg file ?
Did you try to put all files in the homedir of the user ? (you need to rename ansible.cfg in .ansible.cfg with a beginning dot ) ?