Sunday, May 13, 2018

Install Jenkins using Ansible Playbook on Ubuntu | Install Jenkins using Ansible Playbooks

Find below Ansible playbook for installing Jenkins on a Ubuntu machine.

Pre-requisites:
Java needs to be installed already on machine before setting up Jenkins. please Click here for Java Playbook. Here below is the playbook for installing Jenkins using Ansible in Ubuntu EC2:

sudo vi installJenkins.yml
Copy the below yellow highlighted in the above file: 

---
 - hosts: My_Group
  
   tasks:
    - name: ensure the jenkins apt repository key is installed
      apt_key: url=https://pkg.jenkins.io/debian/jenkins.io-2023.key state=present
      become: yes

    - name: ensure the repository is configured
      apt_repository: repo='deb https://pkg.jenkins.io/debian-stable binary/' state=present
      become: yes

    - name: ensure jenkins is installed
      apt: name=jenkins update_cache=yes
      become: yes

    - name: ensure jenkins is running
      service: name=jenkins state=started











sudo vi /etc/ansible/hosts
make sure you add below entry with target node IP changed (in red color).
[My_Group]  
xx.xx.xx.xx ansible_ssh_user=ubuntu ansible_ssh_private_key_file=~/.ssh/id_rsa  ansible_python_interpreter=/usr/bin/python3




Execute the below command:
ansible-playbook installJenkins.yml

This should install Jenkins on the target node and should install Jenkins.

Now enter public ip address or public dns name with port no 8080 of target server by in the browser to see Jenkins up and running.

http://target_node_public_dns_name:8080

5 comments:

  1. Just wanted to check with you to clarify on a couple of book titles. Would you consider either Oliver Twist (Dickens) or Swiss Family Robinson (Wyss) to be children's books? (Just making sure my children's quota doesn't end up over 3!)
    Can You Play

    ReplyDelete
  2. I’ve desired to post about something similar to this on one of my blogs and this has given me an idea. Cool Mat.

    DevOps Training in Pune

    ReplyDelete
  3. Sorry but I am not clear on Step2 here. what have we done? as I am getting 'Command not found.

    ReplyDelete
  4. The DevOps course syllabus spans several topics which are considered vital for the fundamental understanding of the domain. It is designed to cover the intrinsic segments as well, such as the history of DevOps, objectives, software development life cycle, virtual development and management tools. best books to learn DevOps

    ReplyDelete
  5. Great article .thanks for sharing .

    ReplyDelete