O'Reilly logo

Security Automation with Ansible 2 by Akash Mahajan, Madhu Akula

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required