Download as pdf or txt
Download as pdf or txt
You are on page 1of 18

USING ANSIBLE AND JENKINS IN CI/CD

An example lab

Ricardo Zanini (zanini@redhat.com) @zanini_os


Senior Middleware Technical Account Manager
AGENDA
CI/CD with Ansible and Jenkins

Introduction Demo
Tools Integration tips
Reference Architecture Ansible Playbooks
Example pipeline flow Resources

INSERT DESIGNATOR, IF NEEDED


INTRODUCTION

INSERT DESIGNATOR, IF NEEDED


INTRODUCTION
What is this all about?

● Jenkins is great for CI/CD implementation.


● Ansible is a great tool for provisioning.
● Why not reuse our Ansible Roles?
● This process could be applied in different scenarios like on premises, cloud, containers,
bare metal and so on.

INSERT DESIGNATOR, IF NEEDED


TOOLS

For this lab, we are going to use:


● Vagrant + libvirt for virtualization
● Sonar Source for source code quality analysis.
● Maven
● GIT
● Nexus for artifactory repository
● Jenkins for CI/CD process flow
● Ansible for lab provisioning and application deployment

INSERT DESIGNATOR, IF NEEDED


REFERENCE ARCHITECTURE

INSERT DESIGNATOR, IF NEEDED


INSERT DESIGNATOR, IF NEEDED
PIPELINE FLOW

INSERT DESIGNATOR, IF NEEDED


THE PIPELINE

INSERT DESIGNATOR, IF NEEDED


PLAYBOOKS USED IN THIS LAB

INSERT DESIGNATOR, IF NEEDED


INFRASTRUCTURE PROVISIONING
Vagrant <3

INSERT DESIGNATOR, IF NEEDED


APPLICATION DEPLOYMENT
A simple 3 step ansible playbook

INSERT DESIGNATOR, IF NEEDED


DEMO

INSERT DESIGNATOR, IF NEEDED


INTEGRATION TIPS

Here some tips to avoid headaches:


● The target machines should have a Jenkins user with sudo to perform the needed
tasks.
● Prefer adding a SSH private key on Jenkins credentials and access it at the pipeline.
The target machines must have the public key.
● Install your roles before running the playbook.
● You may limit the provision on a set of hosts using the “-limit” option

INSERT DESIGNATOR, IF NEEDED


ANSIBLE PLAYBOOKS

Let's going to see each playbook in detail:


● Lab infrastructure provisioning with Ansible and Vagrant
● Application provisioning from Jenkins pipeline and Ansible

INSERT DESIGNATOR, IF NEEDED


RESOURCES

Everything you're going to need to reproduce this lab:


● Ansible Plugin
● Vagrant ALM @ GitHub
● Soccer Stats (example app) @ GitHub
● How to start using Ansible if I no nothing about platform?

INSERT DESIGNATOR, IF NEEDED


QUESTIONS?

INSERT DESIGNATOR, IF NEEDED


THANK YOU
plus.google.com/+RedHat facebook.com/redhatinc

linkedin.com/company/red-hat twitter.com/RedHatNews

youtube.com/user/RedHatVideos

You might also like