Details
-
Type:
Task
-
Status: Resolved (View Workflow)
-
Priority:
Major
-
Resolution: Fixed
-
Component/s: ansible-plugin
-
Labels:None
-
Environment:ansible 2.4.2.0
config file = /etc/ansible/ansible.cfg
configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python2.7/site-packages/ansible
executable location = /bin/ansible
python version = 2.7.5 (default, May 29 2017, 20:42:36) [GCC 4.8.5 20150623 (Red Hat 4.8.5-11)]
Jenkins Version: 2.107.1
ansible 2.4.2.0 config file = /etc/ansible/ansible.cfg configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules'] ansible python module location = /usr/lib/python2.7/site-packages/ansible executable location = /bin/ansible python version = 2.7.5 (default, May 29 2017, 20:42:36) [GCC 4.8.5 20150623 (Red Hat 4.8.5-11)] Jenkins Version: 2.107.1
-
Similar Issues:
Description
My playbook unable to connect remote host with private key for cloud user.
Getting following error.
suse12sp1 #48 Console [Jenkins]
Started by user Abhay Srivastava
Building in workspace /var/lib/jenkins/workspace/suse12sp1
Installer "Run Shell Command" cannot be used to install "ansible-2.4.2.0" on the node "Jenkins"
[suse12sp1] $ /bin/ansible-playbook /tmp/test.sh -i /tmp/hosts -f 5 --private-key /tmp/ssh1894583294890662940.key -u cloud
ERROR! playbooks must be a list of plays
The error appears to have been in '/tmp/test.sh': line 2, column 1, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
#!/bin/bash
/bin/ansible-playbook /tmp/test.yml -i /tmp/hosts -f 5 --private-key /tmp/KeyPair-1c48_abhay_prod.pem -u cloud
^ here
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:1727)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:429)
ERROR: Ansible playbook execution failed
Finished: FAILURE
my key permission was wrong as it was read only for owner, and Jenkins user trying to access it but due to read 400 permission it was unable to read key file so I changed the permission of key file to 444. Now its working fine.