Configure Jenkins job with Ansible-Jenkins Plugin to setup CI for Ansible playbooks.

Venkata Chitturi
DevOps Process and Tools
2 min readApr 6, 2017

In this post I will go through the configuration of Jenkins job with Ansible plugin to automate the Ansible playbook running.

Pre-requisites on Jenkins server:

Install ansible 2.2 and git version greater than 1.7 ,mostly 2.0 or above.

Jenkisn UI Console:

Step 1: Install ansible plugin using Manage Jenkins Plugins console

Step 2: Configure the ansible installation configuration in Jenkins “Global Tool Configuration” as shown in below pic.

Note: Path of the ansible installed in Jenkins can be found with the below command.

which ansible

/usr/bin/ansible.

Playbook/ansible commands executed correctly when i gave ‘/usr/bin’ in the “path of ansible executable directory”.

step 3: Configure the Jenkins job.

In build step of Jenkins job, select “Invoke Ansible Playbook” and specify the entries of Ansible installation name, playbook path,inventory file path, host subset pattern and the user to execute the command as shown in the below picture.

Note: In host subset entry to limit the group of servers the playbook executed -do not provide quotes as we do in regular playbook command ‘${group}’ /’hostname’. Just provide ${group} /hostname with out quotes.Its the default behavior for jenkins-ansible plugin.

--

--

Venkata Chitturi
DevOps Process and Tools

DevOps Professional. Passionate on learning, implementing and sharing new things.