SlideShare a Scribd company logo
Testing Ansible with
Jenkins and Docker
Dennis Rowe
@shr3kst3r
wpengine.com
Goals
Verify the Ansible code
Run the Ansible code
Verify the Results
• Why we are here
• Automation
• Configuration Management
• “An extensible open source continuous
integration server”
• Lets us run stuff
• Plugins lets you do extra stuff
• The new hotness
• Containers
• Tools for containers
Note
• So, I did it two ways.
• First way, meh
• Second way, less meh, more weeee
The First Way
We Need Two Jobs
Building a Docker
Image
Create our First
Jenkins Project
• Create a freestyle project called “Build
Docker Image”
• Use custom workspace (under
Advanced). I set my workspace to
build_docker_image.
• Configure the source repository (https://
github.com/shr3kst3r/ansible-jenkins-
example.git)
Add “Execute shell”
Build Step
Dockerfile
Running the Build
Docker Images
Running Test with
Docker
Docker Plugins
• “Docker plugin”
• https://wiki.jenkins-ci.org/display/
JENKINS/Docker+Plugin
• “SSH plugin”
• https://wiki.jenkins-ci.org/display/
JENKINS/SSH+plugin
Docker plugin
(configure system)
Add a SSH Remote
Create our Second
Jenkins Project
• Create a freestyle project called
“Project Test Ansible with Docker”
• Use custom workspace (under
Advanced). I set my workspace to
docker_ansible.
• Configure the source repository (https://
github.com/shr3kst3r/ansible-jenkins-
example.git)
Start Container
Execute Tests
test_it
• Lint Ansible code using ansible-lint
(https://github.com/willthames/ansible-
lint)
• Run the Ansible playbook
• Verify environment using Serverspec
(http://serverspec.org/)
• Source: https://github.com/shr3kst3r/
ansible-jenkins-example/blob/master/
test_it
Stop Dockers
Build
Testing Ansible with Jenkins and Docker
Testing Ansible with Jenkins and Docker
Test Container
• I can actually get access to the running
container
• Just delete the “Post-build Action”
• Then run the build
Left Over Container
ssh
The Second Way
Notes
• Similar two the first way, but no Jenkins
plugins.
• Derived from the book “The Docker
Book” by James Turnbull
Thats All
Bonus
Testing on my Mac
• http://boot2docker.io/
• docker build -t jenkins-ansible .
• docker run -v "/Users/dennis/git/ansible-
jenkins-example:/build:rw" jenkins-
ansible /bin/bash -c 'cd /build && ./
test_it’
• docker rm $(docker ps -a -q) # delete
Testing Ansible with Jenkins and Docker
Benefits
• Super fast start times. Do not have to
spin up a server.
• Allows for a very quick test lifecycle (22
seconds total time for this simple
example)
• Reproducible and Consistent
Ansible and Docker
• Some General Info (interesting video):
http://www.ansible.com/docker
• Docker Module: http://
docs.ansible.com/docker_module.html
Odds and Ends
• https://github.com/shr3kst3r/ansible-
jenkins-example
• You can reach me at
dennis@wpengine.com or @shr3kst3r
on the twitters

More Related Content

What's hot (20)

PDF
[CNCF TAG-Runtime 2022-10-06] Lima
Akihiro Suda
 
PPTX
Cypress Testing.pptx
JasmeenShrestha
 
PPTX
Introduction to jenkins
Abe Diaz
 
PDF
Default GitLab CI Pipeline - Auto DevOps
Rajith Bhanuka Mahanama
 
PDF
Using Postman to Automate API On-Boarding
Postman
 
PPTX
Kubernetes PPT.pptx
ssuser0cc9131
 
PDF
Automation with ansible
Khizer Naeem
 
PDF
Ansible
Rahul Bajaj
 
PDF
Intro to Terraform
Josh Michielsen
 
ODP
An Introduction To Jenkins
Knoldus Inc.
 
PPTX
NGINX Installation and Tuning
NGINX, Inc.
 
PDF
Securing Your Atlassian Connect Add-on With JWT
Atlassian
 
PPTX
Jenkins presentation
Valentin Buryakov
 
PPTX
Jenkins CI
Viyaan Jhiingade
 
PDF
Ansible Introduction
Robert Reiz
 
PPTX
Version control system
Aryman Gautam
 
PPT
Jenkins Overview
Ahmed M. Gomaa
 
PPTX
Terraform
Pathum Fernando ☁
 
PDF
Gitlab ci-cd
Dan MAGIER
 
PPTX
Discover Quarkus and GraalVM
Romain Schlick
 
[CNCF TAG-Runtime 2022-10-06] Lima
Akihiro Suda
 
Cypress Testing.pptx
JasmeenShrestha
 
Introduction to jenkins
Abe Diaz
 
Default GitLab CI Pipeline - Auto DevOps
Rajith Bhanuka Mahanama
 
Using Postman to Automate API On-Boarding
Postman
 
Kubernetes PPT.pptx
ssuser0cc9131
 
Automation with ansible
Khizer Naeem
 
Ansible
Rahul Bajaj
 
Intro to Terraform
Josh Michielsen
 
An Introduction To Jenkins
Knoldus Inc.
 
NGINX Installation and Tuning
NGINX, Inc.
 
Securing Your Atlassian Connect Add-on With JWT
Atlassian
 
Jenkins presentation
Valentin Buryakov
 
Jenkins CI
Viyaan Jhiingade
 
Ansible Introduction
Robert Reiz
 
Version control system
Aryman Gautam
 
Jenkins Overview
Ahmed M. Gomaa
 
Gitlab ci-cd
Dan MAGIER
 
Discover Quarkus and GraalVM
Romain Schlick
 

Viewers also liked (8)

PPTX
Test-Driven Infrastructure with Ansible, Test Kitchen, Serverspec and RSpec
Martin Etmajer
 
PDF
15分でわかるGit入門
to_ueda
 
PDF
Gitのよく使うコマンド
YUKI Kaoru
 
PDF
はじめてのGit forデザイナー&コーダー
Saeko Yamamoto
 
PDF
はじめようGit
techscore
 
PDF
デザイナのためのGit入門
dsuke Takaoka
 
PDF
いつやるの?Git入門 v1.1.0
Masakazu Matsushita
 
PDF
こわくない Git
Kota Saito
 
Test-Driven Infrastructure with Ansible, Test Kitchen, Serverspec and RSpec
Martin Etmajer
 
15分でわかるGit入門
to_ueda
 
Gitのよく使うコマンド
YUKI Kaoru
 
はじめてのGit forデザイナー&コーダー
Saeko Yamamoto
 
はじめようGit
techscore
 
デザイナのためのGit入門
dsuke Takaoka
 
いつやるの?Git入門 v1.1.0
Masakazu Matsushita
 
こわくない Git
Kota Saito
 
Ad

Similar to Testing Ansible with Jenkins and Docker (20)

PPTX
docker technology in INTERNET WORLD.pptx
poojadhanrajani
 
PDF
Docker at Djangocon 2013 | Talk by Ken Cochrane
dotCloud
 
PDF
Django and Docker
Docker, Inc.
 
PPTX
DockerSADASDASDA SADASDASDASDASDASDLabs.pptx
MuhamedAhmed35
 
PPTX
Docker lxc win
rahulmore01
 
PPTX
Docker for the new Era: Introducing Docker,its components and tools
Ramit Surana
 
PDF
Docker and Puppet for Continuous Integration
Giacomo Vacca
 
PDF
OSDC 2014: Tobias Schwab - Continuous Delivery with Docker
NETWAYS
 
PDF
An Open-Source Chef Cookbook CI/CD Implementation Using Jenkins Pipelines
Steffen Gebert
 
PPTX
Linux container internals
Ashwin Bilgi
 
PDF
Docker & ci
Patxi Gortázar
 
PDF
ExpoQA 2017 Docker and CI
ElasTest Project
 
PDF
DockerCon SF 2015: Maintaining the Official Node.js Docker Image
Docker, Inc.
 
PPTX
Virtualization, Containers, Docker and scalable container management services
abhishek chawla
 
PDF
DockerCon SF 2015: Maintaining the official node.js docker image
Docker, Inc.
 
PDF
Play Framework + Docker + CircleCI + AWS + EC2 Container Service
Josh Padnick
 
PDF
DCEU 18: Building Your Development Pipeline
Docker, Inc.
 
PPTX
Verifying your Ansible Roles using Docker, Test Kitchen and Serverspec
Edmund Dipple
 
PDF
DevOPS training - Day 2/2
Vincent Mercier
 
PDF
1 docker first_linux_container_hands_on
FEG
 
docker technology in INTERNET WORLD.pptx
poojadhanrajani
 
Docker at Djangocon 2013 | Talk by Ken Cochrane
dotCloud
 
Django and Docker
Docker, Inc.
 
DockerSADASDASDA SADASDASDASDASDASDLabs.pptx
MuhamedAhmed35
 
Docker lxc win
rahulmore01
 
Docker for the new Era: Introducing Docker,its components and tools
Ramit Surana
 
Docker and Puppet for Continuous Integration
Giacomo Vacca
 
OSDC 2014: Tobias Schwab - Continuous Delivery with Docker
NETWAYS
 
An Open-Source Chef Cookbook CI/CD Implementation Using Jenkins Pipelines
Steffen Gebert
 
Linux container internals
Ashwin Bilgi
 
Docker & ci
Patxi Gortázar
 
ExpoQA 2017 Docker and CI
ElasTest Project
 
DockerCon SF 2015: Maintaining the Official Node.js Docker Image
Docker, Inc.
 
Virtualization, Containers, Docker and scalable container management services
abhishek chawla
 
DockerCon SF 2015: Maintaining the official node.js docker image
Docker, Inc.
 
Play Framework + Docker + CircleCI + AWS + EC2 Container Service
Josh Padnick
 
DCEU 18: Building Your Development Pipeline
Docker, Inc.
 
Verifying your Ansible Roles using Docker, Test Kitchen and Serverspec
Edmund Dipple
 
DevOPS training - Day 2/2
Vincent Mercier
 
1 docker first_linux_container_hands_on
FEG
 
Ad

More from Dennis Rowe (7)

PDF
Ansible 2.0
Dennis Rowe
 
PDF
Am I Idempotent?
Dennis Rowe
 
PDF
Drone your Ansible
Dennis Rowe
 
PDF
Investigation of testing with ansible
Dennis Rowe
 
PDF
Switching from Puppet to Ansible
Dennis Rowe
 
PDF
Puppet loves RSpec, why you should, too
Dennis Rowe
 
PDF
Java one 2011 monitoring a large-scale infrastructure with clojure
Dennis Rowe
 
Ansible 2.0
Dennis Rowe
 
Am I Idempotent?
Dennis Rowe
 
Drone your Ansible
Dennis Rowe
 
Investigation of testing with ansible
Dennis Rowe
 
Switching from Puppet to Ansible
Dennis Rowe
 
Puppet loves RSpec, why you should, too
Dennis Rowe
 
Java one 2011 monitoring a large-scale infrastructure with clojure
Dennis Rowe
 

Recently uploaded (20)

PDF
Future-Proof or Fall Behind? 10 Tech Trends You Can’t Afford to Ignore in 2025
DIGITALCONFEX
 
PDF
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
PPTX
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
PDF
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
PDF
“Voice Interfaces on a Budget: Building Real-time Speech Recognition on Low-c...
Edge AI and Vision Alliance
 
PPTX
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
PDF
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 
PPT
Ericsson LTE presentation SEMINAR 2010.ppt
npat3
 
PPTX
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
PDF
AI Agents in the Cloud: The Rise of Agentic Cloud Architecture
Lilly Gracia
 
PDF
SIZING YOUR AIR CONDITIONER---A PRACTICAL GUIDE.pdf
Muhammad Rizwan Akram
 
PPTX
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
PDF
Automating Feature Enrichment and Station Creation in Natural Gas Utility Net...
Safe Software
 
PDF
NASA A Researcher’s Guide to International Space Station : Physical Sciences ...
Dr. PANKAJ DHUSSA
 
PPTX
The Project Compass - GDG on Campus MSIT
dscmsitkol
 
PDF
Staying Human in a Machine- Accelerated World
Catalin Jora
 
PDF
Peak of Data & AI Encore AI-Enhanced Workflows for the Real World
Safe Software
 
PDF
The 2025 InfraRed Report - Redpoint Ventures
Razin Mustafiz
 
PDF
UPDF - AI PDF Editor & Converter Key Features
DealFuel
 
PPTX
Agentforce World Tour Toronto '25 - Supercharge MuleSoft Development with Mod...
Alexandra N. Martinez
 
Future-Proof or Fall Behind? 10 Tech Trends You Can’t Afford to Ignore in 2025
DIGITALCONFEX
 
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
“Voice Interfaces on a Budget: Building Real-time Speech Recognition on Low-c...
Edge AI and Vision Alliance
 
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 
Ericsson LTE presentation SEMINAR 2010.ppt
npat3
 
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
AI Agents in the Cloud: The Rise of Agentic Cloud Architecture
Lilly Gracia
 
SIZING YOUR AIR CONDITIONER---A PRACTICAL GUIDE.pdf
Muhammad Rizwan Akram
 
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
Automating Feature Enrichment and Station Creation in Natural Gas Utility Net...
Safe Software
 
NASA A Researcher’s Guide to International Space Station : Physical Sciences ...
Dr. PANKAJ DHUSSA
 
The Project Compass - GDG on Campus MSIT
dscmsitkol
 
Staying Human in a Machine- Accelerated World
Catalin Jora
 
Peak of Data & AI Encore AI-Enhanced Workflows for the Real World
Safe Software
 
The 2025 InfraRed Report - Redpoint Ventures
Razin Mustafiz
 
UPDF - AI PDF Editor & Converter Key Features
DealFuel
 
Agentforce World Tour Toronto '25 - Supercharge MuleSoft Development with Mod...
Alexandra N. Martinez
 

Testing Ansible with Jenkins and Docker

  • 1. Testing Ansible with Jenkins and Docker Dennis Rowe @shr3kst3r wpengine.com
  • 2. Goals Verify the Ansible code Run the Ansible code Verify the Results
  • 3. • Why we are here • Automation • Configuration Management
  • 4. • “An extensible open source continuous integration server” • Lets us run stuff • Plugins lets you do extra stuff
  • 5. • The new hotness • Containers • Tools for containers
  • 6. Note • So, I did it two ways. • First way, meh • Second way, less meh, more weeee
  • 8. We Need Two Jobs
  • 10. Create our First Jenkins Project • Create a freestyle project called “Build Docker Image” • Use custom workspace (under Advanced). I set my workspace to build_docker_image. • Configure the source repository (https:// github.com/shr3kst3r/ansible-jenkins- example.git)
  • 16. Docker Plugins • “Docker plugin” • https://wiki.jenkins-ci.org/display/ JENKINS/Docker+Plugin • “SSH plugin” • https://wiki.jenkins-ci.org/display/ JENKINS/SSH+plugin
  • 18. Add a SSH Remote
  • 19. Create our Second Jenkins Project • Create a freestyle project called “Project Test Ansible with Docker” • Use custom workspace (under Advanced). I set my workspace to docker_ansible. • Configure the source repository (https:// github.com/shr3kst3r/ansible-jenkins- example.git)
  • 22. test_it • Lint Ansible code using ansible-lint (https://github.com/willthames/ansible- lint) • Run the Ansible playbook • Verify environment using Serverspec (http://serverspec.org/) • Source: https://github.com/shr3kst3r/ ansible-jenkins-example/blob/master/ test_it
  • 24. Build
  • 27. Test Container • I can actually get access to the running container • Just delete the “Post-build Action” • Then run the build
  • 29. ssh
  • 31. Notes • Similar two the first way, but no Jenkins plugins. • Derived from the book “The Docker Book” by James Turnbull
  • 33. Bonus
  • 34. Testing on my Mac • http://boot2docker.io/ • docker build -t jenkins-ansible . • docker run -v "/Users/dennis/git/ansible- jenkins-example:/build:rw" jenkins- ansible /bin/bash -c 'cd /build && ./ test_it’ • docker rm $(docker ps -a -q) # delete
  • 36. Benefits • Super fast start times. Do not have to spin up a server. • Allows for a very quick test lifecycle (22 seconds total time for this simple example) • Reproducible and Consistent
  • 37. Ansible and Docker • Some General Info (interesting video): http://www.ansible.com/docker • Docker Module: http:// docs.ansible.com/docker_module.html
  • 38. Odds and Ends • https://github.com/shr3kst3r/ansible- jenkins-example • You can reach me at [email protected] or @shr3kst3r on the twitters