SlideShare a Scribd company logo
1 of 15
Testing Ansible Infrastructure
with Serverspec
Docker, Serverspec, Ansible, Travis-ci and Test Kitchen.
Ben Visser
Why do we care
about infra
testing?
we have ~50 ansible roles
The 3 Tools
Test Kitchen
This is what we use to spin
up a consistent virtual
environment to run our tests
on.
Serverspec
This is like rspec for
servers. We use it to test
that our infrastructure
does what we want it to.
describe file('/etc/passwd') do
it { should be_file }
end
Travis-ci
This is a hosted CI tool
that we use to spin up a
virtual env with test
kitchen and run tests
with serverspec.
Test Kitchen Components
1.Drivers
Test Kitchen
Drivers allow you to run your tests on cloud
providers or locally with virtualization.
e.g docker, vagrant, azure, aws, and more.
2. Platforms
Test Kitchen
Platform is the operating system you are
running your tests on.
e.g mint, ubuntu, windows
3.Provisioners
Test Kitchen
A provisioner is the configuration
management tool used to provision the
environment.
e.g ansible, salt, chef, puppet
4. Test Suites
Test Kitchen
A test suite is the tests you would like to verify
against the environment.
eg. Bats, Cucumber, Rspec, Serverspec
Our Testing Experiences
First try... we only useed .travis.yml
.travis.yml
Second try...
.travis.yml
Second try...
.kitchen.yml
Second try...
serverspec tests
https://github.com/telusdigital/ansible-nginx
Example repo
TELUS digital » Development

More Related Content

What's hot

Test-Driven Infrastructure with Puppet, Test Kitchen, Serverspec and RSpec
Test-Driven Infrastructure with Puppet, Test Kitchen, Serverspec and RSpecTest-Driven Infrastructure with Puppet, Test Kitchen, Serverspec and RSpec
Test-Driven Infrastructure with Puppet, Test Kitchen, Serverspec and RSpecMartin Etmajer
 
Monitoring and tuning your chef server - chef conf talk
Monitoring and tuning your chef server - chef conf talk Monitoring and tuning your chef server - chef conf talk
Monitoring and tuning your chef server - chef conf talk Andrew DuFour
 
Go Faster with Ansible (PHP meetup)
Go Faster with Ansible (PHP meetup)Go Faster with Ansible (PHP meetup)
Go Faster with Ansible (PHP meetup)Richard Donkin
 
Ansible module development 101
Ansible module development 101Ansible module development 101
Ansible module development 101yfauser
 
DevOps in a Regulated World - aka 'Ansible, AWS, and Jenkins'
DevOps in a Regulated World - aka 'Ansible, AWS, and Jenkins'DevOps in a Regulated World - aka 'Ansible, AWS, and Jenkins'
DevOps in a Regulated World - aka 'Ansible, AWS, and Jenkins'rmcleay
 
Ansible presentation
Ansible presentationAnsible presentation
Ansible presentationSuresh Kumar
 
Testing Ansible with Jenkins and Docker
Testing Ansible with Jenkins and DockerTesting Ansible with Jenkins and Docker
Testing Ansible with Jenkins and DockerDennis Rowe
 
Portland PUG April 2014: Beaker 101: Acceptance Test Everything
Portland PUG April 2014: Beaker 101: Acceptance Test EverythingPortland PUG April 2014: Beaker 101: Acceptance Test Everything
Portland PUG April 2014: Beaker 101: Acceptance Test EverythingPuppet
 
How to Write Chef Cookbook
How to Write Chef CookbookHow to Write Chef Cookbook
How to Write Chef Cookbookdevopsjourney
 
How Ansible Makes Automation Easy
How Ansible Makes Automation EasyHow Ansible Makes Automation Easy
How Ansible Makes Automation EasyPeter Sankauskas
 
What Is Ansible? | How Ansible Works? | Ansible Tutorial For Beginners | DevO...
What Is Ansible? | How Ansible Works? | Ansible Tutorial For Beginners | DevO...What Is Ansible? | How Ansible Works? | Ansible Tutorial For Beginners | DevO...
What Is Ansible? | How Ansible Works? | Ansible Tutorial For Beginners | DevO...Simplilearn
 
Testing with Ansible
Testing with AnsibleTesting with Ansible
Testing with AnsibleBas Meijer
 
Getting started with Ansible
Getting started with AnsibleGetting started with Ansible
Getting started with AnsibleIvan Serdyuk
 
Fake IT, until you make IT
Fake IT, until you make ITFake IT, until you make IT
Fake IT, until you make ITBas Meijer
 
Serverspec and Sensu - Testing and Monitoring collide
Serverspec and Sensu - Testing and Monitoring collideServerspec and Sensu - Testing and Monitoring collide
Serverspec and Sensu - Testing and Monitoring collidem_richardson
 
Ansible Introduction
Ansible Introduction Ansible Introduction
Ansible Introduction Robert Reiz
 
Go Faster with Ansible (AWS meetup)
Go Faster with Ansible (AWS meetup)Go Faster with Ansible (AWS meetup)
Go Faster with Ansible (AWS meetup)Richard Donkin
 
Infrastructure Automation with Chef & Ansible
Infrastructure Automation with Chef & AnsibleInfrastructure Automation with Chef & Ansible
Infrastructure Automation with Chef & Ansiblewajrcs
 
CI/CD Using Ansible and Jenkins for Infrastructure
CI/CD Using Ansible and Jenkins for InfrastructureCI/CD Using Ansible and Jenkins for Infrastructure
CI/CD Using Ansible and Jenkins for InfrastructureFaisal Shaikh
 
Automated Deployments with Ansible
Automated Deployments with AnsibleAutomated Deployments with Ansible
Automated Deployments with AnsibleMartin Etmajer
 

What's hot (20)

Test-Driven Infrastructure with Puppet, Test Kitchen, Serverspec and RSpec
Test-Driven Infrastructure with Puppet, Test Kitchen, Serverspec and RSpecTest-Driven Infrastructure with Puppet, Test Kitchen, Serverspec and RSpec
Test-Driven Infrastructure with Puppet, Test Kitchen, Serverspec and RSpec
 
Monitoring and tuning your chef server - chef conf talk
Monitoring and tuning your chef server - chef conf talk Monitoring and tuning your chef server - chef conf talk
Monitoring and tuning your chef server - chef conf talk
 
Go Faster with Ansible (PHP meetup)
Go Faster with Ansible (PHP meetup)Go Faster with Ansible (PHP meetup)
Go Faster with Ansible (PHP meetup)
 
Ansible module development 101
Ansible module development 101Ansible module development 101
Ansible module development 101
 
DevOps in a Regulated World - aka 'Ansible, AWS, and Jenkins'
DevOps in a Regulated World - aka 'Ansible, AWS, and Jenkins'DevOps in a Regulated World - aka 'Ansible, AWS, and Jenkins'
DevOps in a Regulated World - aka 'Ansible, AWS, and Jenkins'
 
Ansible presentation
Ansible presentationAnsible presentation
Ansible presentation
 
Testing Ansible with Jenkins and Docker
Testing Ansible with Jenkins and DockerTesting Ansible with Jenkins and Docker
Testing Ansible with Jenkins and Docker
 
Portland PUG April 2014: Beaker 101: Acceptance Test Everything
Portland PUG April 2014: Beaker 101: Acceptance Test EverythingPortland PUG April 2014: Beaker 101: Acceptance Test Everything
Portland PUG April 2014: Beaker 101: Acceptance Test Everything
 
How to Write Chef Cookbook
How to Write Chef CookbookHow to Write Chef Cookbook
How to Write Chef Cookbook
 
How Ansible Makes Automation Easy
How Ansible Makes Automation EasyHow Ansible Makes Automation Easy
How Ansible Makes Automation Easy
 
What Is Ansible? | How Ansible Works? | Ansible Tutorial For Beginners | DevO...
What Is Ansible? | How Ansible Works? | Ansible Tutorial For Beginners | DevO...What Is Ansible? | How Ansible Works? | Ansible Tutorial For Beginners | DevO...
What Is Ansible? | How Ansible Works? | Ansible Tutorial For Beginners | DevO...
 
Testing with Ansible
Testing with AnsibleTesting with Ansible
Testing with Ansible
 
Getting started with Ansible
Getting started with AnsibleGetting started with Ansible
Getting started with Ansible
 
Fake IT, until you make IT
Fake IT, until you make ITFake IT, until you make IT
Fake IT, until you make IT
 
Serverspec and Sensu - Testing and Monitoring collide
Serverspec and Sensu - Testing and Monitoring collideServerspec and Sensu - Testing and Monitoring collide
Serverspec and Sensu - Testing and Monitoring collide
 
Ansible Introduction
Ansible Introduction Ansible Introduction
Ansible Introduction
 
Go Faster with Ansible (AWS meetup)
Go Faster with Ansible (AWS meetup)Go Faster with Ansible (AWS meetup)
Go Faster with Ansible (AWS meetup)
 
Infrastructure Automation with Chef & Ansible
Infrastructure Automation with Chef & AnsibleInfrastructure Automation with Chef & Ansible
Infrastructure Automation with Chef & Ansible
 
CI/CD Using Ansible and Jenkins for Infrastructure
CI/CD Using Ansible and Jenkins for InfrastructureCI/CD Using Ansible and Jenkins for Infrastructure
CI/CD Using Ansible and Jenkins for Infrastructure
 
Automated Deployments with Ansible
Automated Deployments with AnsibleAutomated Deployments with Ansible
Automated Deployments with Ansible
 

Viewers also liked

CVTemplate_en_GB europass zugravu
CVTemplate_en_GB europass zugravuCVTemplate_en_GB europass zugravu
CVTemplate_en_GB europass zugravuzugravu adrian
 
Metodos computarizados para resolver ecuaciones diferenciales
Metodos computarizados para resolver ecuaciones diferencialesMetodos computarizados para resolver ecuaciones diferenciales
Metodos computarizados para resolver ecuaciones diferencialesRosa Contramaestre
 
Mobile Banking Student Presentation
Mobile Banking Student PresentationMobile Banking Student Presentation
Mobile Banking Student PresentationRalf Waubke
 
PAUG 03/05/2016 : Rechercher et analyser les fuites mémoires dans une applica...
PAUG 03/05/2016 : Rechercher et analyser les fuites mémoires dans une applica...PAUG 03/05/2016 : Rechercher et analyser les fuites mémoires dans une applica...
PAUG 03/05/2016 : Rechercher et analyser les fuites mémoires dans une applica...Ludovic ROLAND
 
Deep Dive Training Energy Efficiency in Industrial Processes
Deep Dive TrainingEnergy Efficiency in Industrial ProcessesDeep Dive TrainingEnergy Efficiency in Industrial Processes
Deep Dive Training Energy Efficiency in Industrial ProcessesChristoph Emde
 
Aplikasi Gallery Pengetahuan
Aplikasi Gallery PengetahuanAplikasi Gallery Pengetahuan
Aplikasi Gallery Pengetahuanrohmatulk
 
Renaissance Quarterly Review of Brusanus
Renaissance Quarterly Review of BrusanusRenaissance Quarterly Review of Brusanus
Renaissance Quarterly Review of BrusanusJoseph Khoury
 
Statistical Analysis of Interrelationship between Money Supply Exchange Rates...
Statistical Analysis of Interrelationship between Money Supply Exchange Rates...Statistical Analysis of Interrelationship between Money Supply Exchange Rates...
Statistical Analysis of Interrelationship between Money Supply Exchange Rates...Atif Ahmed
 
Illegal Trade of endangered species
Illegal Trade of endangered speciesIllegal Trade of endangered species
Illegal Trade of endangered speciesRashi Rajani
 
Financial Sector Performance and Conceptual Framework
Financial Sector Performance and Conceptual FrameworkFinancial Sector Performance and Conceptual Framework
Financial Sector Performance and Conceptual FrameworkAtif Ahmed
 
González valentin annex_competic2
González valentin annex_competic2González valentin annex_competic2
González valentin annex_competic2antonigau
 
González valentín catàleg_competic2
González valentín catàleg_competic2González valentín catàleg_competic2
González valentín catàleg_competic2antonigau
 
WindEnergyFinal-2-2
WindEnergyFinal-2-2WindEnergyFinal-2-2
WindEnergyFinal-2-2Danny Farr
 
Buyer'sGuideIssuu
Buyer'sGuideIssuuBuyer'sGuideIssuu
Buyer'sGuideIssuuSusan Horak
 

Viewers also liked (20)

CVTemplate_en_GB europass zugravu
CVTemplate_en_GB europass zugravuCVTemplate_en_GB europass zugravu
CVTemplate_en_GB europass zugravu
 
Phonics
Phonics Phonics
Phonics
 
Metodos computarizados para resolver ecuaciones diferenciales
Metodos computarizados para resolver ecuaciones diferencialesMetodos computarizados para resolver ecuaciones diferenciales
Metodos computarizados para resolver ecuaciones diferenciales
 
Doctrina
DoctrinaDoctrina
Doctrina
 
Mobile Banking Student Presentation
Mobile Banking Student PresentationMobile Banking Student Presentation
Mobile Banking Student Presentation
 
PAUG 03/05/2016 : Rechercher et analyser les fuites mémoires dans une applica...
PAUG 03/05/2016 : Rechercher et analyser les fuites mémoires dans une applica...PAUG 03/05/2016 : Rechercher et analyser les fuites mémoires dans une applica...
PAUG 03/05/2016 : Rechercher et analyser les fuites mémoires dans une applica...
 
ResumeE1
ResumeE1ResumeE1
ResumeE1
 
Deep Dive Training Energy Efficiency in Industrial Processes
Deep Dive TrainingEnergy Efficiency in Industrial ProcessesDeep Dive TrainingEnergy Efficiency in Industrial Processes
Deep Dive Training Energy Efficiency in Industrial Processes
 
Aplikasi Gallery Pengetahuan
Aplikasi Gallery PengetahuanAplikasi Gallery Pengetahuan
Aplikasi Gallery Pengetahuan
 
Renaissance Quarterly Review of Brusanus
Renaissance Quarterly Review of BrusanusRenaissance Quarterly Review of Brusanus
Renaissance Quarterly Review of Brusanus
 
Statistical Analysis of Interrelationship between Money Supply Exchange Rates...
Statistical Analysis of Interrelationship between Money Supply Exchange Rates...Statistical Analysis of Interrelationship between Money Supply Exchange Rates...
Statistical Analysis of Interrelationship between Money Supply Exchange Rates...
 
Illegal Trade of endangered species
Illegal Trade of endangered speciesIllegal Trade of endangered species
Illegal Trade of endangered species
 
Financial Sector Performance and Conceptual Framework
Financial Sector Performance and Conceptual FrameworkFinancial Sector Performance and Conceptual Framework
Financial Sector Performance and Conceptual Framework
 
González valentin annex_competic2
González valentin annex_competic2González valentin annex_competic2
González valentin annex_competic2
 
González valentín catàleg_competic2
González valentín catàleg_competic2González valentín catàleg_competic2
González valentín catàleg_competic2
 
WindEnergyFinal-2-2
WindEnergyFinal-2-2WindEnergyFinal-2-2
WindEnergyFinal-2-2
 
Praktek
PraktekPraktek
Praktek
 
Latihan
LatihanLatihan
Latihan
 
Buyer'sGuideIssuu
Buyer'sGuideIssuuBuyer'sGuideIssuu
Buyer'sGuideIssuu
 
My Invoice Finance
My Invoice FinanceMy Invoice Finance
My Invoice Finance
 

Similar to Testing Ansible Infrastructure With Serverspec

What is Test Kitchen
What is Test KitchenWhat is Test Kitchen
What is Test KitchenBenoit Caron
 
Ansible, integration testing, and you.
Ansible, integration testing, and you.Ansible, integration testing, and you.
Ansible, integration testing, and you.Bob Killen
 
Ansible Tutorial.pdf
Ansible Tutorial.pdfAnsible Tutorial.pdf
Ansible Tutorial.pdfNigussMehari4
 
Testing servers like software
Testing servers like softwareTesting servers like software
Testing servers like softwarePeter Souter
 
Ignite Talk on Chef
Ignite Talk on ChefIgnite Talk on Chef
Ignite Talk on ChefBob Nowadly
 
Atmosphere 2018: Yury Tsarev - TEST DRIVEN INFRASTRUCTURE FOR HIGHLY PERFORMI...
Atmosphere 2018: Yury Tsarev - TEST DRIVEN INFRASTRUCTURE FOR HIGHLY PERFORMI...Atmosphere 2018: Yury Tsarev - TEST DRIVEN INFRASTRUCTURE FOR HIGHLY PERFORMI...
Atmosphere 2018: Yury Tsarev - TEST DRIVEN INFRASTRUCTURE FOR HIGHLY PERFORMI...PROIDEA
 
Configuration Management with AWS OpsWorks - November 2016 Webinar Series
Configuration Management with AWS OpsWorks - November 2016 Webinar SeriesConfiguration Management with AWS OpsWorks - November 2016 Webinar Series
Configuration Management with AWS OpsWorks - November 2016 Webinar SeriesAmazon Web Services
 
Why You Need Automated and Manual Mobile App Testing
Why You Need Automated and Manual Mobile App TestingWhy You Need Automated and Manual Mobile App Testing
Why You Need Automated and Manual Mobile App TestingAmazon Web Services
 
AWS OpsWorks Under the Hood (DMG304) | AWS re:Invent 2013
AWS OpsWorks Under the Hood (DMG304) | AWS re:Invent 2013AWS OpsWorks Under the Hood (DMG304) | AWS re:Invent 2013
AWS OpsWorks Under the Hood (DMG304) | AWS re:Invent 2013Amazon Web Services
 
Configuration Management with AWS OpsWorks  by Amir Golan, Senior Product Man...
Configuration Management with AWS OpsWorks  by Amir Golan, Senior Product Man...Configuration Management with AWS OpsWorks  by Amir Golan, Senior Product Man...
Configuration Management with AWS OpsWorks  by Amir Golan, Senior Product Man...Amazon Web Services
 
Configuration Management with AWS OpsWorks
Configuration Management with AWS OpsWorksConfiguration Management with AWS OpsWorks
Configuration Management with AWS OpsWorksAmazon Web Services
 
Ansible windows cheat sheet by anil.k
Ansible windows cheat sheet by anil.kAnsible windows cheat sheet by anil.k
Ansible windows cheat sheet by anil.kanilvm09
 
Test Kitchen and Infrastructure as Code
Test Kitchen and Infrastructure as CodeTest Kitchen and Infrastructure as Code
Test Kitchen and Infrastructure as CodeCybera Inc.
 
Introduction to DevOps
Introduction to DevOpsIntroduction to DevOps
Introduction to DevOpsDmitry Buzdin
 
(DVO301) AWS OpsWorks Under the Hood
(DVO301) AWS OpsWorks Under the Hood(DVO301) AWS OpsWorks Under the Hood
(DVO301) AWS OpsWorks Under the HoodAmazon Web Services
 
From Dev to DevOps
From Dev to DevOpsFrom Dev to DevOps
From Dev to DevOpsAgile Spain
 
Linuxtag 2012 - continuous delivery - dream to reality
Linuxtag 2012  - continuous delivery - dream to realityLinuxtag 2012  - continuous delivery - dream to reality
Linuxtag 2012 - continuous delivery - dream to realityClément Escoffier
 
MongoDB Management & Ansible
MongoDB Management & AnsibleMongoDB Management & Ansible
MongoDB Management & AnsibleMongoDB
 

Similar to Testing Ansible Infrastructure With Serverspec (20)

What is Test Kitchen
What is Test KitchenWhat is Test Kitchen
What is Test Kitchen
 
Ansible, integration testing, and you.
Ansible, integration testing, and you.Ansible, integration testing, and you.
Ansible, integration testing, and you.
 
Ansible Tutorial.pdf
Ansible Tutorial.pdfAnsible Tutorial.pdf
Ansible Tutorial.pdf
 
Ansible - Hands on Training
Ansible - Hands on TrainingAnsible - Hands on Training
Ansible - Hands on Training
 
Testing servers like software
Testing servers like softwareTesting servers like software
Testing servers like software
 
Ignite Talk on Chef
Ignite Talk on ChefIgnite Talk on Chef
Ignite Talk on Chef
 
Atmosphere 2018: Yury Tsarev - TEST DRIVEN INFRASTRUCTURE FOR HIGHLY PERFORMI...
Atmosphere 2018: Yury Tsarev - TEST DRIVEN INFRASTRUCTURE FOR HIGHLY PERFORMI...Atmosphere 2018: Yury Tsarev - TEST DRIVEN INFRASTRUCTURE FOR HIGHLY PERFORMI...
Atmosphere 2018: Yury Tsarev - TEST DRIVEN INFRASTRUCTURE FOR HIGHLY PERFORMI...
 
Configuration Management with AWS OpsWorks - November 2016 Webinar Series
Configuration Management with AWS OpsWorks - November 2016 Webinar SeriesConfiguration Management with AWS OpsWorks - November 2016 Webinar Series
Configuration Management with AWS OpsWorks - November 2016 Webinar Series
 
Why You Need Automated and Manual Mobile App Testing
Why You Need Automated and Manual Mobile App TestingWhy You Need Automated and Manual Mobile App Testing
Why You Need Automated and Manual Mobile App Testing
 
AWS OpsWorks Under the Hood (DMG304) | AWS re:Invent 2013
AWS OpsWorks Under the Hood (DMG304) | AWS re:Invent 2013AWS OpsWorks Under the Hood (DMG304) | AWS re:Invent 2013
AWS OpsWorks Under the Hood (DMG304) | AWS re:Invent 2013
 
Configuration Management with AWS OpsWorks  by Amir Golan, Senior Product Man...
Configuration Management with AWS OpsWorks  by Amir Golan, Senior Product Man...Configuration Management with AWS OpsWorks  by Amir Golan, Senior Product Man...
Configuration Management with AWS OpsWorks  by Amir Golan, Senior Product Man...
 
Configuration Management with AWS OpsWorks
Configuration Management with AWS OpsWorksConfiguration Management with AWS OpsWorks
Configuration Management with AWS OpsWorks
 
Ansible windows cheat sheet by anil.k
Ansible windows cheat sheet by anil.kAnsible windows cheat sheet by anil.k
Ansible windows cheat sheet by anil.k
 
Test Kitchen and Infrastructure as Code
Test Kitchen and Infrastructure as CodeTest Kitchen and Infrastructure as Code
Test Kitchen and Infrastructure as Code
 
Introduction to DevOps
Introduction to DevOpsIntroduction to DevOps
Introduction to DevOps
 
(DVO301) AWS OpsWorks Under the Hood
(DVO301) AWS OpsWorks Under the Hood(DVO301) AWS OpsWorks Under the Hood
(DVO301) AWS OpsWorks Under the Hood
 
From Dev to DevOps
From Dev to DevOpsFrom Dev to DevOps
From Dev to DevOps
 
AWS OpsWorks for Chef Automate
AWS OpsWorks for Chef AutomateAWS OpsWorks for Chef Automate
AWS OpsWorks for Chef Automate
 
Linuxtag 2012 - continuous delivery - dream to reality
Linuxtag 2012  - continuous delivery - dream to realityLinuxtag 2012  - continuous delivery - dream to reality
Linuxtag 2012 - continuous delivery - dream to reality
 
MongoDB Management & Ansible
MongoDB Management & AnsibleMongoDB Management & Ansible
MongoDB Management & Ansible
 

Testing Ansible Infrastructure With Serverspec

Editor's Notes

  1. really messy testing hard to test with only bash no testing framework used most commonly used for ansible roles