How do I get the Ansible plugin to work with Jenkins?

301 views
Skip to first unread message

Kiran

unread,
Feb 2, 2016, 8:46:33 PM2/2/16
to Jenkins Users
My Ansible (version 1.9.5) server is on its own dedicated CentOS 7 server.  My Jenkins (version 1.6) server is on its own dedicated CentOS 7 server.  I installed the Ansible plugin for Jenkins.  I created a New Item that invokes an ad-hoc Ansible command.  For the Ansible Installation field, I enter the DNS name of the Ansible server.  For host pattern, I chose the group of servers that I want the Ansible playbook to run again.  The group name was defined in the .../ansible/hosts file.

The console output of this new Jenkins job that should invoke an ansible command (on a separate server with Ansible installed) says this:

"Building in workspace /var/lib/jenkins/jobs/... $ sshpass ****** /ansible ... DNSnameOfAnsibleServer -i ... FATAL: command execution failed hudson.AbortException: Ansible Ad-Hoc command execution failed at org.jenkinsci.plugins.ansible.AnsibleAdHocCommandBuilder.perform(AnsibleAdHocCommandBuilder.java:176 at ..."

Does the Ansible server need sshpass? The Jenkins server has sshpass.

How do I get Jenkins to invoke an ansible playbook on an Ansible server?  This error makes me think that something is wrong with sshpass.  I can view the man page of sshpass.  Is there a certain version that I need?

jcsirot

unread,
Feb 3, 2016, 5:14:20 AM2/3/16
to Jenkins Users
Hi Kiran,

The jenkins is not able to remotely execute the ansible command. The installation field in the global configuration must contain the path of the directory where the ansible binaries are installed. Note that in the last release of the plugin this configuration is not required anymore when ansible is available in the PATH environment variable.

There are two possible solutions: either you install ansible on your Jenkins server or you setup your Ansible server as a Jenkins slave.

Hope this helps.

-- 
Jean-Christophe
Reply all
Reply to author
Forward
0 new messages