• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

UnixArena

  • Home
  • kubernetes
  • DevOps
    • Terraform
    • Jenkins
    • Docker
    • Openshift
      • OKD
    • Ansible engine
    • Ansible Tower
      • AWX
    • Puppet
  • Cloud
    • Azure
    • AWS
    • Openstack
    • Docker
  • VMware
    • vCloud Director
    • VMware-Guests
    • Vcenter Appliance 5.5
    • vC OPS
    • VMware SDDC
    • VMware vSphere 5.x
      • vSphere Network
      • vSphere DS
      • vShield Suite
    • VMware vSphere 6.0
    • VSAN
    • VMware Free Tools
  • Backup
    • Vembu BDR
    • Veeam
    • Nakivo
    • Azure Backup
    • Altaro VMBackup
    • Spinbackup
  • Tutorials
    • Openstack Tutorial
    • Openstack Beginner’s Guide
    • VXVM-Training
    • ZFS-Tutorials
    • NetApp cDot
    • LVM
    • Cisco UCS
    • LDOM
    • Oracle VM for x86
  • Linux
    • How to Articles
    • Q&A
    • Networking
    • RHEL7
  • DevOps Instructor-led Training
  • Contact

Ansible Engine – Run Playbook using Jenkins – GUI

March 29, 2019 By Cloud_Devops 5 Comments

Can’t afford Ansible Tower? Worried about  AWX stability  (Open Source Ansible Tower’s upstream Project )? Jenkins is more than enough to run the Ansible playbook from GUI. Ansible Tower’s main selling point is RBAC (Role based access control), credentials encryption and REST API. When you use Jenkins, it has plenty of plugins to offer role-based access control, in-built credentials encryption, and API support. In this article, we will walk through how to integrate ansible playbook in Jenkins and test it. At some point, I felt Jenkins is powerful enough on enterprise infrastructure automation.

Required Components on RHEL 7/Cent OS :

  • Jenkins
  • Ansible Engine
  • Internet Connectivity

 

1. Download and install Jenkins on RHEL 7 /CentOS 7.

 

2. Download and install Ansible Engine on RHEL 7 / CentOS 7.

 

Installing and Configuring Ansible plugin for Jenkins:

3. Login to Jenkins portal as an administrator.

 

4. Search for Ansible plugin and install it.

Install Ansible Plugin - Jenkins
Install Ansible Plugin – Jenkins

 

Navigate to the global tool configuration.

Jenkins - Global Tool configuration - Ansible
Jenkins – Global Tool configuration – Ansible

 

You must update the ansible executable paths in Ansible plugin configuration like below.

Configure Ansible Engine path - Jenkins
Configure Ansible Engine path – Jenkins

 

 

Integrating Ansible Playbook in Jenkins Job: 

5. Once the ansible plugin is installed, we are good to start creating the freeform style template to invoke ansible playbook.

Jenkins - Freestyle project for Ansible integration
Jenkins – Freestyle project for Ansible integration

 

6. Enter the job name. Here, my playbook will simply check the root filesystem usage on Linux hosts.

Freestyle Jenkins Job Name - Ansible
Freestyle Jenkins Job Name – Ansible

 

7. Update the valid description of the job and click on “Build”.

Description of the Jenkins Job
Description of the Jenkins Job

 

8. Select “Invoke Ansible Playbook” from “Add build step”.

Jenkins Invoke Ansible Playbook
Jenkins Invoke Ansible Playbook

 

9. Enter the playbook path and host inventory path. Add credentials if the playbook requires authentication via password.

Ansible Playbook and Host Path - Jenkins
Ansible Playbook and Host Path – Jenkins

 

10. Enter the credentials for ansible client nodes.  (remote user)

Credentials - Jenkins
Credentials – Jenkins

 

11. Select the credentials which you have just added on the job and Save the job.

Select the credentials for Ansible Play
Select the credentials for Ansible Play

 

 

Testing the Jenkins Job:

12. From the job, click on Build to trigger the playbook.

Build Jenkins Job - invoke Ansible playbook
Build Jenkins Job – invoke Ansible playbook

 

13. When you click the job ID, you will be navigated to the following page.

Click on Build Job Number - Jenkins
Click on Build Job Number – Jenkins

 

14. Click on console output to see the Ansible playbook output.

Jenkins Build Job - Ansible console output
Jenkins Build Job – Ansible console output

 

We have successfully integrated ansible playbook in Jenkins. Hope this article is informative to you.

Share it! Comment it!! Be Sociable!!!

Filed Under: Ansible engine, DevOps, Jenkins Tagged With: Ansible, Jenkins

Reader Interactions

Comments

  1. Gen Luna says

    August 11, 2020 at 6:14 pm

    hi i followed the steps but it cannot find my playbook.

    Reply
    • Lingeswaran R says

      August 23, 2020 at 9:44 pm

      Ansible & Jenkins should be on same server.

      Reply
  2. Younes says

    April 3, 2020 at 1:56 pm

    Hello,

    My Ansible server is not in the same VM as Jenkins. So, how to configure Ansible plugin in Jenkins with the ip adress of the remote ansible server to established the ssh connection ?

    Thank you

    Reply
    • Lingeswaran R says

      April 3, 2020 at 3:24 pm

      I see some challenges doing that. If possible, install ansible engine on jenkins server to make things simple.

      Thank you
      Lingesh

      Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

Follow UnixArena

  • Facebook
  • LinkedIn
  • Twitter

Copyright © 2025 · UnixArena ·

Go to mobile version