Thursday, December 3, 2015

Setup Jenkins using Ansible

In this document I’ll walk you through how you can  setup jenkins using ansible.

  •  OS - Ubuntu {at least two machine required in production}
  •  First machine for Ansible  installation
  •  Second machine where we will install jenkins server
  • You should have basic understanding of ansible workflow.
Note :  You should have password less login enabled in second machine. use this link

Ansible Installation
Before starting with installing jenkins using ansible, you need to have ansible installed in your system.

 $ curl | sudo bash

Setup jenkins using Ansible

Install jenkins ansible roles

Once we have ansible installed in our system, we can start installing the jenkins using ansible. To install we will use an already available ansible role to setup jenkins

$ ansible-galaxy install geerlingguy.jenkins
to know more about the jenkins role hit this link

Ansible roles default directory path is /etc/ansible/roles
Make ansible playbook file
Now the next step is to use the installed jenkins roles to install the jenkins. For this purpose we will create a playbook  and hosts file with below content

$ cd ~/MyPlaybook/jenkins
create a file hosts and add below content

Screenshot from 2015-11-30 12:55:41.png

Next create  a file site.yml and add below content
- hosts: jenkins_hosts
     - { role: geerlingguy.jenkins }

Screenshot from 2015-11-30 12:59:08.png

so configuration file is done, the next step is to run ansible playbook command
$ ansible-playbook -i hosts site.yml
Now that Jenkins is running, go to You'll be welcome by the default Jenkins screen.


  1. Which ip should i use as jenkins_hosts ?

  2. Use the ip of the system where the jenkins has to be installed, If its on the same machine use localhost

  3. Hye, I cannot find the MyPlaybook/jenkins directory

  4. $ansible-playbook -i hosts site.yml
    after running above command on ubuntu 14.04, I got following error message
    "ERROR: include_tasks is not a legal parameter in an Ansible task or handler"
    please suggest any idea to overcome above ERROR - Thanks


Docker-Compose As A Bundled Application

When docker came to market as a virtualization tool, it blew the market out of proportion. With its lightweight images, multi-os suppor...