Creating the Ansible playbook for Jenkins

Start by navigating to our ansible roles directory:

$ cd ansible/roles  

This directory should contain the helloworld and nodejs directories, with the configurations that we created previously in Chapter 3, Treating Your Infrastructure as Code. We are now going to create our Jenkins role with the ansible-galaxy command:

$ ansible-galaxy init jenkins  

We are now going to edit the task definition for this new role by editing the file: jenkins/tasks/main.yml. Open up the file with your favorite text editor.

The goal of our task is to install and start Jenkins. In order to do this, since we are on a Linux-based operating system (AWS Amazon Linux, in our case), we are going to install an RPM package through ...

Get Effective DevOps with AWS - Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.