Skip to content
Ansible playbook: Jenkins
Branch: development
Clone or download
Pull request Compare This branch is 2 commits ahead, 67 commits behind ICTO:development.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.



ansible-jenkins is an Ansible role. Use this role to install Jenkins and install/update plugins.


  1. Latest Jenkins server
  2. Jenkins plugins support


  1. Ansible 1.4 or higher
  2. Debian 7.3 (other deb-based distros should work too)
  3. Vagrant (optional)


Get the code

$ git clone

The code should reside in the roles directory of ansible ( See ansible documentation for more information on roles ), in a folder jenkins.

Create a host file

Following example make ansible aware of the Vagrant box reachable on localhost port 2222.

$ vi


[jenkins] ansible_ssh_port=2222

Create host specific variables

Make the host_vars directory where file is located.

$ mkdir host_vars

Create a file in the newly created directory matching your host.

$ cd host_vars
$ vi


  - 'ldap'
  - 'github'
  - 'translation'
  - 'preSCMbuildstep'

Run the playbook

First create a playbook including the jenkins role, naming it jenkins.yml.

- name: Jenkins
  hosts: jenkins
    - ansible-jenkins

Use as inventory. Run the playbook only for the remote host jenkins. Use vagrant as the SSH user to connect to the remote host. -k enables the SSH password prompt.

$ ansible-playbook -k -i jenkins.yml -u vagrant

Example output

SSH password: 

PLAY [Jenkins] **************************************************************** 

GATHERING FACTS *************************************************************** 
ok: []

TASK: [ansible-jenkins | Install python-software-properties] ****************** 
ok: []

TASK: [ansible-jenkins | Add jenkins apt-key] ********************************* 
ok: []

TASK: [ansible-jenkins | Add Jenkins repository] ****************************** 
ok: []

TASK: [ansible-jenkins | Install dependencies] ******************************** 
ok: [] => (item=openjdk-6-jre)
ok: [] => (item=openjdk-6-jdk)
ok: [] => (item=git)
ok: [] => (item=curl)

TASK: [ansible-jenkins | Install Jenkins] ************************************* 
ok: []

TASK: [ansible-jenkins | 10s delay while starting Jenkins] ******************** 
skipping: []

TASK: [ansible-jenkins | Create Jenkins CLI destination directory: /opt/jenkins] *** 
ok: []

TASK: [ansible-jenkins | Get Jenkins CLI] ************************************* 
ok: []

TASK: [ansible-jenkins | Get Jenkins updates] ********************************* 
ok: []

TASK: [ansible-jenkins | Update-center Jenkins] ******************************* 
skipping: []

TASK: [ansible-jenkins | List plugins] **************************************** 
skipping: []

TASK: [ansible-jenkins | Install/update plugins] ****************************** 
skipping: [] => (item=plugins)

TASK: [ansible-jenkins | List plugins to be updated] ************************** 
changed: []

TASK: [ansible-jenkins | Update plugins] ************************************** 
skipping: []

PLAY RECAP ********************************************************************                  : ok=11   changed=1    unreachable=0    failed=0  
You can’t perform that action at this time.