SlideShare a Scribd company logo
Puppet Development Workflow
Bio - Jeff Smith
• Manager, Site Reliability Engineering
at Grubhub
• Puppet User for about 2 years
• Yes, we are also hiring.
• Yes, there is free food. Yes, it's totally
awesome to work here.
Email: jsmith@grubhub.com
Twitter: @DarkAndNerdy
Blog: http://www.allthingsdork.com
Agenda
• High level Environment Overview
• Local workstation setup
• How we solve problems
• Branching strategy
• Committing, Automated Testing and Publishing
Puppet Environment
Local Workstation Setup
Editor Setup
• VIM
• tmux
• Nerd Tree
• Powerline
Puppet Development Workflow
Local Testing Tools
Listing tools can help you can syntax errors before you commit
code!
Local Linting Tools
• jsonlint
• puppet parser validate
• erb syntax checker
VIM Linting Function Example
function LintFile()
let l:currentfile = expand('%:p')
if &ft == 'puppet'
let l:command = "puppet-lint " . l:currentfile
elseif &ft == 'eruby.html'
let l:command = "erb -P -x -T '-' " . l:currentfile . "| ruby -c"
elseif &ft == 'json'
let l:command = 'jsonlint -q ' . l:currentfile
end
silent !clear
execute "!" . l:command . " " . bufname("%")
endfunction
map :call LintFile()
Guard
Guard is a command line tool to easily handle events on file
system modifications.
guard-puppet - A configuration of Guard geared towards
Puppet manifests and syntax.
Find more at https://github.com/johnbintz/guard-puppet
Vagrant Environment
It's easier to make changes locally then to a committed
repository. Use Vagrant for test VMs
• Puppet Master
• 2 Agents (only 1 started by default)
• Shares the puppet repo on the Host machine and uses that
as the module path in the VM
config.vm.define "master" do |master|
master.vm.box = "centos65-base-small"
if not ENV['PUPPETREPO'].nil?
puppet_path = ENV['PUPPETREPO']
else
puppet_path = ENV['HOME']+'/Development/puppet'
end
config.vm.synced_folder puppet_path, "/manifests", type: "nfs"
master.vm.network "private_network", ip: "172.16.1.10"
master.vm.network :forwarded_port, host: 10443, guest: 443
config.vm.hostname = "pe.local.vm"
master.vm.provision :hosts
config.pe_build.version = '3.3.2'
config.pe_build.download_root = 'http://s3.amazonaws.com/specialbuildbucket/'
master.vm.provision :hosts do |provisioner|
provisioner.add_host '172.16.1.11', ['agent.local.vm', 'agent']
provisioner.add_host '172.16.1.12', ['agent-2.local.vm', 'agent-2']
end
master.vm.provision :pe_bootstrap do |provisioner|
provisioner.role = :master
#provisioner.relocate_manifests = true
end
master.vm.provision :shell, inline: "service iptables stop;chkconfig --level 3 iptables off"
master.vm.provision :shell, path: 'bootstrap.sh'
end
How We Approach Development
Guiding Principles
• YAGNI - You Ain't Gonna Need It
• DRY - Don't Repeat Yourself
• Modules, Profiles, Roles
• Have respect for what you're doing
• Write your manifests in Puppet
You Ain't Gonna Need It
It's great to build your module to support CentOS, Ubuntu,
Solaris, AIX. But if your shop only has CentOS, has only ever
used CentOS and has plans to only use CentOS...........code for
CentOS.
• Adds too much time to development
• Complicates a potentially simple solution
• Not being tested in those environments so probably won't
work anyways
Don't Repeat Yourself
When you see the same piece of code showing up over and
over again, there's an opportunity.
• Limit the scope of where changes need to happen
• Compose your modules in a way that makes them reusable
• Hard-Coding is the devil
Modules, Profiles and Roles
Compose your Puppet manifests into 3 separate categories
• Modules - Contains the implementation details of a module.
Responsible for the plumbing.
• Profiles - Leverages modules to implement business logic.
Takes your "Apache" module and turns it into "Payroll_Web"
• Roles - Takes all of the profiles necessary to make a
complete system.
Only assign roles to a node and only 1 role per node
Have Respect for What You're Doing
YOU ARE PROGRAMMING
Write Your Manifests in Puppet
file { '/opt/app/config.ini':
ensure => file,
content => template('config.erb')
}
OR
payroll_config { 'database_connection':
property => 'dbserver',
value => 'dbserver1.example.com:3306'
}
Time to Write Some Code!
Puppet Forge is
Your Friend
• Someone has the same problem as
you
• More eyeballs on the same problem
• More flexible
• Less Work
Branching Strategy
Largely will depend on your environment. We have a single
Puppet repository for everything. (Don't do this)
3 Phases of Development
Local => Preprod => Production
Local Development
• Use Vagrant for test VMs
• Make all changes prior to commit
• Use linting
• Test using your local Puppet Master VM and Agent
• Set FACTS or variables via Custom Facts
Writing Test Cases
Be highly selective about what you test in Puppet.
Puppet Code
file { '/opt/app/config.ini':
ensure => file,
content => template('app/config.erb')
}
RSpec Puppet Test
it { should contain_file('/opt/app/config.ini) }
Puppet
Things To Test
1. File Syntax
2. Conditional Branches
3. Interpreted Values (e.g. RegEx evaluations, Facts)
4. Catalog Compilation
Getting Code to the Puppet
Master
• Work off a branch. Branch name should match your ticket
• Push your branch to the remote origin server
• Push your branch to the Pre-prod Puppet Master Remote
Repo (optional)
• Create a Pull Request from your branch, into the Develop
Branch
Branching Workflow Diagram
Automated Test Execution
CI Server watches master/develop branch. Executes tests on
change
1. Script executes to determine which files have changed
2. Linting is performed on changed files (if applicable)
3. Catalog compilation of changed manifests
4. Execution of manifests specific tests (if applicable)
5. Deployment of code to the Puppet Masters
Auto Deployment
Building Confidence
With enough confidence in the process you should be able to
• Deploy your changes to production after a commit and
successful automated testing
• Regular Puppet runs on production systems
• Iterate on changes faster
Move slowly. Go piece by piece. Every small step you take
adds value immediately. Bite off small bits.
Questions?

More Related Content

What's hot (20)

PDF
Ansible and AWS
Peter Sankauskas
 
PPTX
Vagrant and Chef on FOSSASIA 2014
Michael Lihs
 
PDF
infra-as-code
Itamar Hassin
 
PPTX
Go Faster with Ansible (PHP meetup)
Richard Donkin
 
PDF
Continuous Testing with Molecule, Ansible, and GitHub Actions
Jeff Geerling
 
PDF
Portland PUG April 2014: Beaker 101: Acceptance Test Everything
Puppet
 
PDF
Testing Ansible with Jenkins and Docker
Dennis Rowe
 
PPTX
Testing Ansible Infrastructure With Serverspec
Benji Visser
 
PDF
Experiences from Running Masterless Puppet - PuppetConf 2014
Puppet
 
PPTX
Ansible Best Practices - July 30
tylerturk
 
PPTX
Automate your Development Environment with Vagrant & Chef
Michael Lihs
 
PDF
Deploying PHP Applications with Ansible
Orestes Carracedo
 
PPTX
Ansible module development 101
yfauser
 
PDF
Docker
Michael Lihs
 
PPTX
Cyansible
Alan Norton
 
PPTX
Ansible: How to Get More Sleep and Require Less Coffee
Sarah Z
 
PDF
Automated Deployment and Configuration Engines. Ansible
Alberto Molina Coballes
 
PDF
Take control of your Jenkins jobs via job DSL.
Łukasz Proszek
 
PDF
Ansible Case Studies
Greg DeKoenigsberg
 
PDF
Getting Started with Ansible
Ahmed AbouZaid
 
Ansible and AWS
Peter Sankauskas
 
Vagrant and Chef on FOSSASIA 2014
Michael Lihs
 
infra-as-code
Itamar Hassin
 
Go Faster with Ansible (PHP meetup)
Richard Donkin
 
Continuous Testing with Molecule, Ansible, and GitHub Actions
Jeff Geerling
 
Portland PUG April 2014: Beaker 101: Acceptance Test Everything
Puppet
 
Testing Ansible with Jenkins and Docker
Dennis Rowe
 
Testing Ansible Infrastructure With Serverspec
Benji Visser
 
Experiences from Running Masterless Puppet - PuppetConf 2014
Puppet
 
Ansible Best Practices - July 30
tylerturk
 
Automate your Development Environment with Vagrant & Chef
Michael Lihs
 
Deploying PHP Applications with Ansible
Orestes Carracedo
 
Ansible module development 101
yfauser
 
Docker
Michael Lihs
 
Cyansible
Alan Norton
 
Ansible: How to Get More Sleep and Require Less Coffee
Sarah Z
 
Automated Deployment and Configuration Engines. Ansible
Alberto Molina Coballes
 
Take control of your Jenkins jobs via job DSL.
Łukasz Proszek
 
Ansible Case Studies
Greg DeKoenigsberg
 
Getting Started with Ansible
Ahmed AbouZaid
 

Viewers also liked (20)

PDF
Sense and Sensu-bility: Painless Metrics And Monitoring In The Cloud with Sensu
Bethany Erskine
 
PDF
Puppet Camp Atlanta 2014: Continuous Deployment of Puppet Modules
Puppet
 
PDF
Puppet Camp Sydney 2015: The (Im)perfect Puppet Module
Puppet
 
PDF
Using Vagrant, Puppet, Testing & Hadoop
Puppet
 
PDF
Devops, Dungeons & Dragons
David Lutz
 
PDF
Writing and Publishing Puppet Modules - PuppetConf 2014
Puppet
 
PDF
Puppet - Configuration Management Made Eas(ier)
Aaron Bernstein
 
PDF
Docker
Andrea Laspada
 
PDF
A Introduction of Packer
Freyr Lin
 
PDF
Docker internals
Rohit Jnagal
 
PDF
EC2 AMI Factory with Chef, Berkshelf, and Packer
George Miranda
 
PPTX
Packer, where DevOps begins
Jeff Hung
 
PDF
Usecase examples of Packer
Hiroshi SHIBATA
 
PDF
Docker and Puppet for Continuous Integration
Giacomo Vacca
 
PPTX
C#: Globalization and localization
Rohit Vipin Mathews
 
ODP
Connascence
Kevin Rutherford
 
PDF
Puppet Conf 2012 - Managing Network Devices with Puppet
Nan Liu
 
PPT
Deploying puppet code at light speed
Tomas Doran
 
KEY
Dates aghhhh!!?!?!?!
Tomas Doran
 
PDF
Docker Architecture (v1.3)
rajdeep
 
Sense and Sensu-bility: Painless Metrics And Monitoring In The Cloud with Sensu
Bethany Erskine
 
Puppet Camp Atlanta 2014: Continuous Deployment of Puppet Modules
Puppet
 
Puppet Camp Sydney 2015: The (Im)perfect Puppet Module
Puppet
 
Using Vagrant, Puppet, Testing & Hadoop
Puppet
 
Devops, Dungeons & Dragons
David Lutz
 
Writing and Publishing Puppet Modules - PuppetConf 2014
Puppet
 
Puppet - Configuration Management Made Eas(ier)
Aaron Bernstein
 
A Introduction of Packer
Freyr Lin
 
Docker internals
Rohit Jnagal
 
EC2 AMI Factory with Chef, Berkshelf, and Packer
George Miranda
 
Packer, where DevOps begins
Jeff Hung
 
Usecase examples of Packer
Hiroshi SHIBATA
 
Docker and Puppet for Continuous Integration
Giacomo Vacca
 
C#: Globalization and localization
Rohit Vipin Mathews
 
Connascence
Kevin Rutherford
 
Puppet Conf 2012 - Managing Network Devices with Puppet
Nan Liu
 
Deploying puppet code at light speed
Tomas Doran
 
Dates aghhhh!!?!?!?!
Tomas Doran
 
Docker Architecture (v1.3)
rajdeep
 
Ad

Similar to Puppet Development Workflow (20)

PDF
Puppet Camp New York 2014: Streamlining Puppet Development Workflow
Puppet
 
PDF
Greenfield Puppet: Getting it right from the start
David Danzilio
 
PDF
Puppet Camp Boston 2014: Greenfield Puppet: Getting it right from the start (...
Puppet
 
PDF
Creating a mature puppet system
rkhatibi
 
PDF
Creating a Mature Puppet System
Puppet
 
PPTX
Puppet Camp Silicon Valley 2015: How TubeMogul reached 10,000 Puppet Deployme...
Nicolas Brousse
 
PDF
Improving Operations Efficiency with Puppet
Nicolas Brousse
 
PDF
Our Puppet Story (GUUG FFG 2015)
DECK36
 
PPTX
Puppetizing Your Organization
Robert Nelson
 
PDF
20140406 loa days-tdd-with_puppet_tutorial
garrett honeycutt
 
PPTX
Puppet
John Coggeshall
 
PDF
DevOps Series: Extending vagrant with Puppet for configuration management
Felipe
 
PDF
Puppet | Custom Modules & Using the Forge
Aaron Bernstein
 
PDF
TDD with Puppet Tutorial presented at Cascadia IT Conference 2014-03-07
garrett honeycutt
 
PDF
Test-Driven Puppet Development - PuppetConf 2014
Puppet
 
PDF
Puppet Camp Berlin 2015: Felix Frank | Rapid Testing Setups for Puppet
NETWAYS
 
PDF
Puppet Camp Berlin 2015: Rapid testing Setups for Puppet
Puppet
 
PDF
Configuration Management with Puppet
Rachel Andrew
 
PDF
Strategies for Puppet code upgrade and refactoring
Alessandro Franceschi
 
PDF
Our Puppet Story – Patterns and Learnings (sage@guug, March 2014)
DECK36
 
Puppet Camp New York 2014: Streamlining Puppet Development Workflow
Puppet
 
Greenfield Puppet: Getting it right from the start
David Danzilio
 
Puppet Camp Boston 2014: Greenfield Puppet: Getting it right from the start (...
Puppet
 
Creating a mature puppet system
rkhatibi
 
Creating a Mature Puppet System
Puppet
 
Puppet Camp Silicon Valley 2015: How TubeMogul reached 10,000 Puppet Deployme...
Nicolas Brousse
 
Improving Operations Efficiency with Puppet
Nicolas Brousse
 
Our Puppet Story (GUUG FFG 2015)
DECK36
 
Puppetizing Your Organization
Robert Nelson
 
20140406 loa days-tdd-with_puppet_tutorial
garrett honeycutt
 
DevOps Series: Extending vagrant with Puppet for configuration management
Felipe
 
Puppet | Custom Modules & Using the Forge
Aaron Bernstein
 
TDD with Puppet Tutorial presented at Cascadia IT Conference 2014-03-07
garrett honeycutt
 
Test-Driven Puppet Development - PuppetConf 2014
Puppet
 
Puppet Camp Berlin 2015: Felix Frank | Rapid Testing Setups for Puppet
NETWAYS
 
Puppet Camp Berlin 2015: Rapid testing Setups for Puppet
Puppet
 
Configuration Management with Puppet
Rachel Andrew
 
Strategies for Puppet code upgrade and refactoring
Alessandro Franceschi
 
Our Puppet Story – Patterns and Learnings (sage@guug, March 2014)
DECK36
 
Ad

More from Jeffery Smith (9)

PPTX
Cutting Costs in COVID-19
Jeffery Smith
 
PDF
Moving from ops to dev ops
Jeffery Smith
 
PDF
Making On-Call More Humane - Ignite Version
Jeffery Smith
 
PDF
Elevate Your Career as an Ops Engineer
Jeffery Smith
 
PDF
Dungeons and dragons and dev ops
Jeffery Smith
 
PDF
DevOps: What's Buried in the Fine Print
Jeffery Smith
 
PDF
Starting with c
Jeffery Smith
 
PDF
It Sounded Good on Paper - Lessons Learned with Puppet
Jeffery Smith
 
PDF
Brainstorming failure
Jeffery Smith
 
Cutting Costs in COVID-19
Jeffery Smith
 
Moving from ops to dev ops
Jeffery Smith
 
Making On-Call More Humane - Ignite Version
Jeffery Smith
 
Elevate Your Career as an Ops Engineer
Jeffery Smith
 
Dungeons and dragons and dev ops
Jeffery Smith
 
DevOps: What's Buried in the Fine Print
Jeffery Smith
 
Starting with c
Jeffery Smith
 
It Sounded Good on Paper - Lessons Learned with Puppet
Jeffery Smith
 
Brainstorming failure
Jeffery Smith
 

Recently uploaded (20)

PDF
“Squinting Vision Pipelines: Detecting and Correcting Errors in Vision Models...
Edge AI and Vision Alliance
 
PDF
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 
DOCX
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
PPTX
Digital Circuits, important subject in CS
contactparinay1
 
PPTX
Designing_the_Future_AI_Driven_Product_Experiences_Across_Devices.pptx
presentifyai
 
PDF
Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
PDF
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
PDF
Staying Human in a Machine- Accelerated World
Catalin Jora
 
PDF
AI Agents in the Cloud: The Rise of Agentic Cloud Architecture
Lilly Gracia
 
PDF
Peak of Data & AI Encore AI-Enhanced Workflows for the Real World
Safe Software
 
PPTX
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
PDF
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
PDF
Automating Feature Enrichment and Station Creation in Natural Gas Utility Net...
Safe Software
 
PPTX
Agentforce World Tour Toronto '25 - Supercharge MuleSoft Development with Mod...
Alexandra N. Martinez
 
PPTX
Seamless Tech Experiences Showcasing Cross-Platform App Design.pptx
presentifyai
 
PDF
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
PPTX
The Project Compass - GDG on Campus MSIT
dscmsitkol
 
PDF
UPDF - AI PDF Editor & Converter Key Features
DealFuel
 
PDF
NASA A Researcher’s Guide to International Space Station : Physical Sciences ...
Dr. PANKAJ DHUSSA
 
PPTX
MuleSoft MCP Support (Model Context Protocol) and Use Case Demo
shyamraj55
 
“Squinting Vision Pipelines: Detecting and Correcting Errors in Vision Models...
Edge AI and Vision Alliance
 
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
Digital Circuits, important subject in CS
contactparinay1
 
Designing_the_Future_AI_Driven_Product_Experiences_Across_Devices.pptx
presentifyai
 
Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
Staying Human in a Machine- Accelerated World
Catalin Jora
 
AI Agents in the Cloud: The Rise of Agentic Cloud Architecture
Lilly Gracia
 
Peak of Data & AI Encore AI-Enhanced Workflows for the Real World
Safe Software
 
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
Automating Feature Enrichment and Station Creation in Natural Gas Utility Net...
Safe Software
 
Agentforce World Tour Toronto '25 - Supercharge MuleSoft Development with Mod...
Alexandra N. Martinez
 
Seamless Tech Experiences Showcasing Cross-Platform App Design.pptx
presentifyai
 
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
The Project Compass - GDG on Campus MSIT
dscmsitkol
 
UPDF - AI PDF Editor & Converter Key Features
DealFuel
 
NASA A Researcher’s Guide to International Space Station : Physical Sciences ...
Dr. PANKAJ DHUSSA
 
MuleSoft MCP Support (Model Context Protocol) and Use Case Demo
shyamraj55
 

Puppet Development Workflow

  • 2. Bio - Jeff Smith • Manager, Site Reliability Engineering at Grubhub • Puppet User for about 2 years • Yes, we are also hiring. • Yes, there is free food. Yes, it's totally awesome to work here. Email: [email protected] Twitter: @DarkAndNerdy Blog: http://www.allthingsdork.com
  • 3. Agenda • High level Environment Overview • Local workstation setup • How we solve problems • Branching strategy • Committing, Automated Testing and Publishing
  • 5. Local Workstation Setup Editor Setup • VIM • tmux • Nerd Tree • Powerline
  • 7. Local Testing Tools Listing tools can help you can syntax errors before you commit code! Local Linting Tools • jsonlint • puppet parser validate • erb syntax checker
  • 8. VIM Linting Function Example function LintFile() let l:currentfile = expand('%:p') if &ft == 'puppet' let l:command = "puppet-lint " . l:currentfile elseif &ft == 'eruby.html' let l:command = "erb -P -x -T '-' " . l:currentfile . "| ruby -c" elseif &ft == 'json' let l:command = 'jsonlint -q ' . l:currentfile end silent !clear execute "!" . l:command . " " . bufname("%") endfunction map :call LintFile()
  • 9. Guard Guard is a command line tool to easily handle events on file system modifications. guard-puppet - A configuration of Guard geared towards Puppet manifests and syntax. Find more at https://github.com/johnbintz/guard-puppet
  • 10. Vagrant Environment It's easier to make changes locally then to a committed repository. Use Vagrant for test VMs • Puppet Master • 2 Agents (only 1 started by default) • Shares the puppet repo on the Host machine and uses that as the module path in the VM
  • 11. config.vm.define "master" do |master| master.vm.box = "centos65-base-small" if not ENV['PUPPETREPO'].nil? puppet_path = ENV['PUPPETREPO'] else puppet_path = ENV['HOME']+'/Development/puppet' end config.vm.synced_folder puppet_path, "/manifests", type: "nfs" master.vm.network "private_network", ip: "172.16.1.10" master.vm.network :forwarded_port, host: 10443, guest: 443 config.vm.hostname = "pe.local.vm" master.vm.provision :hosts config.pe_build.version = '3.3.2' config.pe_build.download_root = 'http://s3.amazonaws.com/specialbuildbucket/' master.vm.provision :hosts do |provisioner| provisioner.add_host '172.16.1.11', ['agent.local.vm', 'agent'] provisioner.add_host '172.16.1.12', ['agent-2.local.vm', 'agent-2'] end master.vm.provision :pe_bootstrap do |provisioner| provisioner.role = :master #provisioner.relocate_manifests = true end master.vm.provision :shell, inline: "service iptables stop;chkconfig --level 3 iptables off" master.vm.provision :shell, path: 'bootstrap.sh' end
  • 12. How We Approach Development Guiding Principles • YAGNI - You Ain't Gonna Need It • DRY - Don't Repeat Yourself • Modules, Profiles, Roles • Have respect for what you're doing • Write your manifests in Puppet
  • 13. You Ain't Gonna Need It It's great to build your module to support CentOS, Ubuntu, Solaris, AIX. But if your shop only has CentOS, has only ever used CentOS and has plans to only use CentOS...........code for CentOS. • Adds too much time to development • Complicates a potentially simple solution • Not being tested in those environments so probably won't work anyways
  • 14. Don't Repeat Yourself When you see the same piece of code showing up over and over again, there's an opportunity. • Limit the scope of where changes need to happen • Compose your modules in a way that makes them reusable • Hard-Coding is the devil
  • 15. Modules, Profiles and Roles Compose your Puppet manifests into 3 separate categories • Modules - Contains the implementation details of a module. Responsible for the plumbing. • Profiles - Leverages modules to implement business logic. Takes your "Apache" module and turns it into "Payroll_Web" • Roles - Takes all of the profiles necessary to make a complete system. Only assign roles to a node and only 1 role per node
  • 16. Have Respect for What You're Doing YOU ARE PROGRAMMING
  • 17. Write Your Manifests in Puppet file { '/opt/app/config.ini': ensure => file, content => template('config.erb') } OR payroll_config { 'database_connection': property => 'dbserver', value => 'dbserver1.example.com:3306' }
  • 18. Time to Write Some Code!
  • 19. Puppet Forge is Your Friend • Someone has the same problem as you • More eyeballs on the same problem • More flexible • Less Work
  • 20. Branching Strategy Largely will depend on your environment. We have a single Puppet repository for everything. (Don't do this) 3 Phases of Development Local => Preprod => Production
  • 21. Local Development • Use Vagrant for test VMs • Make all changes prior to commit • Use linting • Test using your local Puppet Master VM and Agent • Set FACTS or variables via Custom Facts
  • 22. Writing Test Cases Be highly selective about what you test in Puppet. Puppet Code file { '/opt/app/config.ini': ensure => file, content => template('app/config.erb') } RSpec Puppet Test it { should contain_file('/opt/app/config.ini) }
  • 24. Things To Test 1. File Syntax 2. Conditional Branches 3. Interpreted Values (e.g. RegEx evaluations, Facts) 4. Catalog Compilation
  • 25. Getting Code to the Puppet Master • Work off a branch. Branch name should match your ticket • Push your branch to the remote origin server • Push your branch to the Pre-prod Puppet Master Remote Repo (optional) • Create a Pull Request from your branch, into the Develop Branch
  • 27. Automated Test Execution CI Server watches master/develop branch. Executes tests on change 1. Script executes to determine which files have changed 2. Linting is performed on changed files (if applicable) 3. Catalog compilation of changed manifests 4. Execution of manifests specific tests (if applicable) 5. Deployment of code to the Puppet Masters
  • 29. Building Confidence With enough confidence in the process you should be able to • Deploy your changes to production after a commit and successful automated testing • Regular Puppet runs on production systems • Iterate on changes faster Move slowly. Go piece by piece. Every small step you take adds value immediately. Bite off small bits.