SlideShare a Scribd company logo
Phil Zimmerman phil.zimmerman@twcable.com
https://twitter.com/phil_zimmerman







Software defined infrastructure – perfect for
VCS
Configuration Management for servers
Declarative language written in Ruby DSL
Uses manifests to define server
configurations
Brings servers into a desired state and keeps
them there
Eliminates “snowflake” environments


Puppet Modules
 Self-contained bundles of code
 Develop your own

 Download from the Puppet Forge

(https://forge.puppetlabs.com/)
 Contain manifests, files, templates and, ahem… tests


Puppet Manifests
 End in the .pp file extension
 Each manifest in a puppet module should contain

one class or defined type
 Define the set of resources
(packages, files, services) that the module
represents
 Can contain logic
(conditionals, collections, functions, etc)
 Are the source for the compiled catalog


The catalog
 Represents the DAG (directed acyclic graph) of






resources and the desired system state for a given
node
Is compiled from the set of modules’ manifests
defined for a given node
In master/agent puppet, compiled by the master
and applied on the agent node
Masterless puppet, compiled locally on node
Represented on disk as a YAML document
Puppet meetup testing






Need to upgrade Java version on tomcat6
vms
Get latest puppet code from vcs
Make the version change in my manifest
Simple change, it looks good to me
Commit my changes
Puppet meetup testing
Oh no – Java was updated on my tomcat7 vms
too…. Wait, wat?!
 Face Palm


FAIL!!
Puppet meetup testing







Puppet manifests are code
Improve consistency and predictability of
server provisioning
Well-defined tools (rspec-puppet, puppet
parser, puppet-lint, serverspec, vagrant, etc.)
Automatable
Complex, data-driven server configuration
Think of others and future you!








Syntax Checking
Static Analysis
Unit Tests (rspec-puppet)
Configure Jenkins to Run These
Vagrant
Server-spec
Packer
puppet parser validate
-make sure the manifests will generate a
catalog
puppet-lint
-make sure we adhere to the puppet
style guide


rspec-puppet (http://rspec-puppet.com/)





Written by Tim Sharpe (https://github.com/rodjek)
rspec, extended to work with puppet
“unit tests” for puppet code
Designed to test the catalog
▪
▪
▪
▪

Tests at the module level, not system level
Verify resources are present and dependencies are met
Verify resources are configured as expected
Verify file content (even when using templates and hiera –
yes!)

 puppetlabs-spec_helper (Rakefile, .fixtures.yml)


rspec-puppet ruby gem
 rspec-puppet-init
▪ Rakefile
▪ spec/spec_helper.rb
▪ spec/{classes,defines,functions,hosts,fixtures}



puppetlabs_spec_helper ruby gem
 .fixtures.yml

 Ideal for testing manifests referencing forge modules



Both gems work together to ease the burden of
boilerplate setup and configuration
Puppet meetup testing
Test that the sshd package is installed
Make sure sshd_config file is present with
desired attributes:
Ensure sshd_config has certain entries:
Verify sshd service is enabled and running with
proper resource dependencies in place:


Parameterized class
 let(:params) { {:foo => ‘abc’, :bar => ‘xyz’} }



Specify values for facter facts
 let(:facts) { {:operatingsystem =>

‘CentOS’, :ipaddress => ‘192.168.33.10’} }


Specify fqdn for a node
 let(:node) { ‘puppet-test-01.lab.webapps.rr.com’ }
Puppet meetup testing
hiera-puppet-helper gem
Puppet meetup testing
Puppet meetup testing
Puppet meetup testing
Puppet meetup testing
Puppet meetup testing
Puppet meetup testing




This is awesome, but we’re not done
Next level of testing is to perform a puppet
run on a test vm and verify all is good
We are ready for a server test – enter
serverspec


Server Spec (http://serverspec.org/)
 Designed to validate that a server is configured

appropriately after it’s been provisioned
 Independent of
Puppet, Chef, CFEngine, SaltStack, etc.
 Tests your servers’ actual state directly via ssh
▪ No server-side software or agents required!




serverspec ruby gem
similar dsl as rspec, rspec-puppet
serverspec-init
 spec dir
 sample spec file
 spec_helper.rb
 Rakefile
Puppet meetup testing
Puppet meetup testing
Puppet meetup testing
describe iptables do
it { should have_rule(‘-P INPUT ACCEPT’).with_table(‘mangle’).with_chain(‘INPUT’) }
end
describe port(2003) do
it { should be_listening.with(‘udp’) }
end
describe package(‘httpd’) do
it { should be_installed }
end
describe service(‘sshd’) do
it { should be_monitored_by(‘monit’) }
end
Puppet meetup testing
Puppet meetup testing



We use Puppet Enterprise at TWC
Vagrantfile that auto installs and configures
Puppet Enterprise master and agent(s)
 https://github.com/adrienthebo/vagrant-pe_build






Personal replica of production Puppet
Enterprise setup
Can apply any role to the agent and test the
server config
Destroy the agent vm when done








“Create identical machine images for multiple
platforms from a single source configuration”
Supports all the main provisioners including Puppet
Can optionally create a vagrant box from the same
source configuration
Automatable and Testable
Extendable plugin architecture
Powerful option for any vm architecture, especially
cloud-based (internal and external)
Full of awesome


Miscellaneous Links







http://www.slideshare.net/PuppetLabs/stephen-connolly
http://www.slideshare.net/PuppetLabs/automated-puppet-testing-puppetcampchicago-12-scott-nottingham
https://github.com/adrienthebo/vagrant-pe_build
https://github.com/puppetlabs/rspec-system

Vim Tools


Syntastic (https://github.com/scrooloose/syntastic)
▪



Vim-puppet (https://github.com/rodjek/vim-puppet)
▪
▪



Checks syntax and displays errors to the user
Syntax highlighting
Style checking

Cool Tool Links




Vagrant - http://www.vagrantup.com
Packer - http://www.packer.io
Stackhammer - http://www.cloudsmith.com

More Related Content

PDF
Performance Tuning Your Puppet Infrastructure - PuppetConf 2014
PDF
Foreman presentation
PDF
A user's perspective on SaltStack and other configuration management tools
PDF
SaltConf14 - Anita Kuno, HP & OpenStack - Using SaltStack for event-driven or...
PDF
SaltConf14 - Forrest Alvarez, Choice Hotels - Salt Formulas and States
KEY
Puppet for dummies - ZendCon 2011 Edition
PDF
The Puppet Master on the JVM - PuppetConf 2014
PDF
The SaltStack Pub Crawl - Fosscomm 2016
Performance Tuning Your Puppet Infrastructure - PuppetConf 2014
Foreman presentation
A user's perspective on SaltStack and other configuration management tools
SaltConf14 - Anita Kuno, HP & OpenStack - Using SaltStack for event-driven or...
SaltConf14 - Forrest Alvarez, Choice Hotels - Salt Formulas and States
Puppet for dummies - ZendCon 2011 Edition
The Puppet Master on the JVM - PuppetConf 2014
The SaltStack Pub Crawl - Fosscomm 2016

What's hot (20)

PDF
Arnold Bechtoldt, Inovex GmbH Linux systems engineer - Configuration Manageme...
PDF
OpenNebula and SaltStack - OpenNebulaConf 2013
PDF
Test Driven Development with Puppet - PuppetConf 2014
PDF
Continuous Infrastructure: Modern Puppet for the Jenkins Project - PuppetConf...
PDF
Puppet fundamentals
PDF
Puppet in the Pipeline
PDF
Tp install anything
PPTX
SaltConf 2014: Safety with powertools
PDF
Orchestrated Functional Testing with Puppet-spec and Mspectator
PPT
Capistrano
PPTX
Ansible intro
PDF
Puppet Camp DC 2015: Distributed OpenSCAP Compliance Validation with MCollective
PDF
A quick intro to Ansible
PPTX
Deployment with capistrano
PPT
Capistrano - Deployment Tool
PDF
Introducing Ansible
PDF
Ansible 實戰:top down 觀點
PPTX
Ansible module development 101
PPT
Spark Streaming Info
PPTX
Control your deployments with Capistrano
Arnold Bechtoldt, Inovex GmbH Linux systems engineer - Configuration Manageme...
OpenNebula and SaltStack - OpenNebulaConf 2013
Test Driven Development with Puppet - PuppetConf 2014
Continuous Infrastructure: Modern Puppet for the Jenkins Project - PuppetConf...
Puppet fundamentals
Puppet in the Pipeline
Tp install anything
SaltConf 2014: Safety with powertools
Orchestrated Functional Testing with Puppet-spec and Mspectator
Capistrano
Ansible intro
Puppet Camp DC 2015: Distributed OpenSCAP Compliance Validation with MCollective
A quick intro to Ansible
Deployment with capistrano
Capistrano - Deployment Tool
Introducing Ansible
Ansible 實戰:top down 觀點
Ansible module development 101
Spark Streaming Info
Control your deployments with Capistrano
Ad

Viewers also liked (20)

PDF
Ata pune 12 meetup 17 September 2016 - Introduction by Amol Deshpande
PPTX
Peer Meetup introduction & networking by Safaraz Ali delivered on 18th Nov 2016
PDF
Integration Testing for Polyglot Ecosystems
ODP
Agille Testing Meetup 1
KEY
Acunu Cassandra London Meetup
PPTX
Paris Qa meetup - The testing family
PDF
Ruby meetup 7_years_in_testing
PDF
Agile Testing Alliance Chapter and Meetup Details - June 2016
PDF
Introduction to Reactive
PDF
Ata pune 12 meetup Future of testing 17 sep 2016 by sanjay upadhyay
PPTX
Paris Qa Meetup - Testing Family
PDF
Java Beginners Meetup February 2017: Testing and TDD
PDF
Meetup kickoff slides - Perfecto Mobile, September 2014
PPTX
DevOps Columbus Meetup Kickoff - Infrastructure as Code
PPTX
RST - Makati Testers Meetup
PPTX
Meetup Testing Workshop 2016 - Gatling para pruebas de performance - Federico...
PDF
Helsinki Legal Tech Meetup introduction
PDF
NoVA UX Meetup: Product Testing and Data-informed Design
PPTX
Tundra at Agile Mississauga Meetup Kick off Event
PDF
The Invisible Art Of Software Testing
Ata pune 12 meetup 17 September 2016 - Introduction by Amol Deshpande
Peer Meetup introduction & networking by Safaraz Ali delivered on 18th Nov 2016
Integration Testing for Polyglot Ecosystems
Agille Testing Meetup 1
Acunu Cassandra London Meetup
Paris Qa meetup - The testing family
Ruby meetup 7_years_in_testing
Agile Testing Alliance Chapter and Meetup Details - June 2016
Introduction to Reactive
Ata pune 12 meetup Future of testing 17 sep 2016 by sanjay upadhyay
Paris Qa Meetup - Testing Family
Java Beginners Meetup February 2017: Testing and TDD
Meetup kickoff slides - Perfecto Mobile, September 2014
DevOps Columbus Meetup Kickoff - Infrastructure as Code
RST - Makati Testers Meetup
Meetup Testing Workshop 2016 - Gatling para pruebas de performance - Federico...
Helsinki Legal Tech Meetup introduction
NoVA UX Meetup: Product Testing and Data-informed Design
Tundra at Agile Mississauga Meetup Kick off Event
The Invisible Art Of Software Testing
Ad

Similar to Puppet meetup testing (20)

PDF
PuppetDB: Sneaking Clojure into Operations
PPTX
Introduction to InSpec and 1.0 release update
PDF
Developing IT infrastructures with Puppet
PPTX
Puppet quick start guide
PPTX
Automated Puppet Testing - PuppetCamp Chicago '12 - Scott Nottingham
PPTX
Puppet camp chicago-automated_testing2
PPTX
Installaling Puppet Master and Agent
PDF
Orchestrated Functional Testing with Puppet-spec and Mspectator - PuppetConf ...
PPTX
Puppet_training
PPTX
Riga Dev Day - Automated Android Continuous Integration
PPTX
BuildStuff.LT 2018 InSpec Workshop
PDF
Puppet: From 0 to 100 in 30 minutes
PPTX
Puppet - an introduction
PDF
Getting started with puppet and vagrant (1)
PPS
A Presentation about Puppet that I've made at the OSSPAC conference
PDF
Continuous Delivery: The Next Frontier
PPTX
DevOpsDays InSpec Workshop
PDF
#OktoCampus - Workshop : An introduction to Ansible
PDF
Build Automation 101
PuppetDB: Sneaking Clojure into Operations
Introduction to InSpec and 1.0 release update
Developing IT infrastructures with Puppet
Puppet quick start guide
Automated Puppet Testing - PuppetCamp Chicago '12 - Scott Nottingham
Puppet camp chicago-automated_testing2
Installaling Puppet Master and Agent
Orchestrated Functional Testing with Puppet-spec and Mspectator - PuppetConf ...
Puppet_training
Riga Dev Day - Automated Android Continuous Integration
BuildStuff.LT 2018 InSpec Workshop
Puppet: From 0 to 100 in 30 minutes
Puppet - an introduction
Getting started with puppet and vagrant (1)
A Presentation about Puppet that I've made at the OSSPAC conference
Continuous Delivery: The Next Frontier
DevOpsDays InSpec Workshop
#OktoCampus - Workshop : An introduction to Ansible
Build Automation 101

Recently uploaded (20)

PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PDF
Machine learning based COVID-19 study performance prediction
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Electronic commerce courselecture one. Pdf
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
cuic standard and advanced reporting.pdf
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
KodekX | Application Modernization Development
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PDF
Chapter 3 Spatial Domain Image Processing.pdf
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PPT
Teaching material agriculture food technology
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
Machine learning based COVID-19 study performance prediction
“AI and Expert System Decision Support & Business Intelligence Systems”
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Electronic commerce courselecture one. Pdf
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
cuic standard and advanced reporting.pdf
Unlocking AI with Model Context Protocol (MCP)
Advanced methodologies resolving dimensionality complications for autism neur...
Digital-Transformation-Roadmap-for-Companies.pptx
Per capita expenditure prediction using model stacking based on satellite ima...
Review of recent advances in non-invasive hemoglobin estimation
KodekX | Application Modernization Development
CIFDAQ's Market Insight: SEC Turns Pro Crypto
Chapter 3 Spatial Domain Image Processing.pdf
The AUB Centre for AI in Media Proposal.docx
Building Integrated photovoltaic BIPV_UPV.pdf
Teaching material agriculture food technology
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...

Puppet meetup testing

Editor's Notes

  • #5: We will look at a manifest and what a catalog is in the next few slides
  • #6: Bullet 1: resource graph and all the dependenciesBullet 2: a given node can have several modules defined for resources that need to be on that systemBullet 3: puppet source lives on master; agent has no puppet code.
  • #36: This gives an idea of how validate the server is configured as expected. If time permits, we can demo thisNow we will shift focus