Setting up Jenkins

Let's use an Ansible playbook to install Jenkins and get started with it. 

The following code snippet is a snippet of an Ansible playbook we wrote for setting up Jenkins in the Ubuntu 16.04 OS.

Once the setup has been done, playbook returns the default administrator password required to log in to the application for the first time:

- name: installing jenkins in ubuntu 16.04  hosts: "192.168.1.7"  remote_user: ubuntu  gather_facts: False  become: Truetasks:  - name: install python 2    raw: test -e /usr/bin/python || (apt -y update && apt install -y python-minimal)  - name: install curl and git    apt: name={{ item }} state=present update_cache=yes    with_items:      - curl      - git
  - name: adding jenkins gpg key
    apt_key:
      url: https://pkg.jenkins.io/debian/jenkins-ci.org.key ...

Get Security Automation with Ansible 2 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.