SlideShare ist ein Scribd-Unternehmen logo
1 von 43
Downloaden Sie, um offline zu lesen
DECONFIGURATION
MANAGEMENT
MAKING PUPPET CLEAN UP ITS OWN MESS
JOSH SNYDER
WHAT'S THE PROBLEM?
We use Puppet
We change things
I have been known to deploy 20 times daily
And Puppet runs every 30 minutes
That thing you deployed in a hurry isn't always in the place it should be
long term.
Or...we deploy a thing, and decide next week (or tomorrow) that it isn't
right for us
Or we just straight-up make mistakes
Or our coworkers make mistakes
git revertcan't save me
My colleague sends me a PR to deploy memcached config files under a new
path. Should I comment on their failure to clean up the old ones?
YES!
But they're busy
But I'm busy
And I really want to get home to make dinner
WHAT ARE OUR OPTIONS?
IGNORE THE PROBLEM
Ignore it! It probably won't hurt anything
Except it will confuse people.
It WILL confuse you, at two AM
JVM versions will exist on some older dev machines, but not newer ones
WRITE CODE TO CLEAN UP AFTER OTHER CODE
file { '/etc/memcached.conf':
ensure => absent,
}
ENSEMBLES OF RESOURCES GET COMPLEX
if $ensure == 'present' {
file { '/etc/init/memcached.conf':
ensure => 'file',
...
}
} else {
file { '/etc/init/memcached.conf':
ensure => 'absent',
...
}
}
NO FUN AT ALL
more code to write
more code to review
my cleanup code might be broken
someone has to clean up the cleanup code
WRITE MORE CODE (IN A DIFFERENT LANGUAGE)
Use Ansible clean up a er Puppet?
REBUILD MACHINES
Good! Cattle, not pets
I'm deploying new changes every 30 minutes
We only clean things up every day?
30 days? 60 days? Five years?
∃ an impedance and tooling mismatch
IMMUTABLE IMAGES
A more aggressive version of rebuilding machines
Use if it suits you
THE SOLUTION (TO ALL YOUR PROBLEMS)
1. Use Puppet to specify what should be deployed
2. Allow Puppet to remove anything it doesn't know about
WHAT'S TO COME?
A few basic examples (directory purging, cronjobs, hosts)
A bit of Puppet internals
Use Puppet internals to achieve more purging
BATTERIES ARE INCLUDED
DIRECTORY PURGING
file { '/etc/cassandra':
ensure => 'directory',
recurse => true,
purge => true,
force => true,
...
}
WHAT WILL THIS DO?
Use puppet agent --noop
Or add  noop => true
Look at the system:
$ ls /etc/cassandra
...
$ dpkg -S /etc/cassandra
...
EXAMPLE 1: PARTIAL MANAGEMENT
Situation: We want to purge /etc/cassandra, but we need to generate
the list of seeds outside of Puppet
file { '/etc/cassandra':
ensure => directory,
recurse => true,
purge => true,
force => true,
...
}
file { '/etc/cassandra/seeds':
ensure => file,
replace => false,
...
}
EXAMPLE 2: CRONJOBS
Lots of cronjobs
Lots of cronjobs!
Using Yelp's
One file per job in /etc/cron.d
puppet-cron
PURGING CRONJOBS
Problem: purge => truewould wipe out crons provided by Debian
packages.
Option ImplicationsOption Implications
Recompile cron to read from a
supplemental directory
Anyone else using
would have to use our patched cron
Create Fileresources for each
file we expect a from a deb.
Whenever someone installs a
package with a new cronjob in it,
they'd get a nasty surprise
Find some way to identify those
cronjobs that were originally
created by Puppet
Good
puppet-cron
What this solution ends up looking like: (ish)
file { '/nail/etc/cron.d':
ensure => directory,
purge => true,
force => true,
recurse => true,
}
file { '/nail/etc/cron.d/myjob':
ensure => file,
...
} ->
file { '/etc/cron.d/myjob':
ensure => link,
target => '/nail/etc/cron.d/myjob',
}
github.com/Yelp/puppet-cron
EXAMPLE 3: /ETC/HOSTS
Puppet agent has a RAL
(resource abstraction layer)
RAL is responsible for
representing resources on the
system as Puppet Resource objects
$ puppet resource host
host { 'ip6-allnodes':
ensure => 'present',
ip => 'ff02::1',
target => '/etc/hosts',
}
host { 'ip6-allrouters':
ensure => 'present',
ip => 'ff02::2',
target => '/etc/hosts',
}
host { 'localhost':
ensure => 'present',
Puppet diffs resources in the catalog against the RAL it constructs
Could we ask it remove resources present in the RAL but not in the catalog?
YES!
IT'S THIS SIMPLE
resources { 'host':
purge => true,
}
Use noop => trueto try before you buy
HOW IT WORKS
All on the agent, a er catalog compilation
Iterate over resources, calling the generateor eval_generate
method on each.
Each resource has the opportunity to add more resources to the Puppet
run.
Walkthrough: fetching files from a fileserver
file { '/etc/cassandra':
ensure => directory,
source => 'puppet:///modules/cassandra/config_dir',
recurse => true,
purge => true,
force => true,
}
1. Get catalog with this resource declared
2. Puppet agent calls eval_generateon this resource
3. eval_generateexamines the disk, compares it with the Puppet
fileserver
4. Generates more resources to represent the files beneath this directory
HOW THE RESOURCESTYPE WORKS
resources { 'host':
purge => true,
}
1. Puppet calls generate
2. Generate finds all resources of type Hostin the catalog
3. Asks providers of Hostfor their instances
4. Compare the two
5. Emit new resources:
host { 'ip6-allnodes':
ensure => absent,
}
MOVING BEYOND THE BUILTINS
PURGING UNDESIRED DEBIAN PACKAGES
Let's say I do:
resources { 'package':
purge => true,
}
This happens:
Notice: /Stage[main]/Main/Package[libxtst6]/ensure: current_value
Notice: /Stage[main]/Main/Package[libxcb-dri3-0]/ensure: current_va
Notice: /Stage[main]/Main/Package[powermgmt-base]/ensure: current_v
Notice: /Stage[main]/Main/Package[python3-py]/ensure: current_value
Notice: /Stage[main]/Main/Package[libtk8.6]/ensure: current_value
Notice: /Stage[main]/Main/Package[node-ansi-color-table]/ensure:
Notice: /Stage[main]/Main/Package[libxpp3-java]/ensure: current_val
Notice: /Stage[main]/Main/Package[python3-newt]/ensure: current_val
Notice: /Stage[main]/Main/Package[bsdmainutils]/ensure: current_val
Notice: /Stage[main]/Main/Package[libpulse0]/ensure: current_value
Notice: /Stage[main]/Main/Package[liblvm2app2.2]/ensure: current_va
NO BUENO
Why doesn't puppet understand that it should remove all packages that:
aren't in the catalog
no other package depends on
We need to be dependency-aware
What removes packages and is dependency aware?
apt-get autoremove
APT-GET AUTOREMOVE
Divides packages into:
manually installed (we're sure we want this)
auto installed (a dependency)
THIS MAPS WELL TO PUPPET
puppet state ⇒ autoremover state
puppet state ⇒ autoremover state
in catalog manually installed
not in catalog automatically installed
AN IMPLEMENTATION COMES TOGETHER
1. Synchronize the autoremover database with the Puppet catalog
2. Run apt-get autoremove
3. Problem?
AN IMPLEMENTATION COMES TOGETHER (PARTE DUEX)
1. Synchronize the autoremover database with the Puppet catalog
2. Run apt-get -s autoremove
3. Read the output and create Puppet package resources
4. Much rejoicing!
github.com/hashbrowncipher/puppet-package_purging
GENERAL PURPOSE SOLUTIONS?
Could there be a jack-of-all-trades solution to purging?
What if we could do:
purge { 'user':
unless => [ 'uid', '<=', '500' ],
}
It exists: github.com/crayfishx/puppet-purge
BONUS FUN STUFF
NOT MY FAVORITE DEFAULT
Q: What does this do?
package { 'mysql-server-5.7': }
package { 'bash': }
A: Creates version dri
UPGRADE (SOME OF THE) THINGS
package { 'mysql-server-5.7':
ensure => $my_favorite_mysql_version
}
package { 'bash': }
aptly_purgecan set all versioned packages as held by dpkg
aptly_purge { 'packages':
hold => true,
}
Upshot: apt-get dist-upgradeand unattended-upgrades
will only touch packages without a specific Puppet version specified.
END MATTER
Please do tell me your stories of Puppet resource purging.
Walk up and say hi right now.
works toojosh@code406.com
in Puppet Community Slack@josnyder

Weitere ähnliche Inhalte

Was ist angesagt?

JavaScript - Like a Box of Chocolates
JavaScript - Like a Box of ChocolatesJavaScript - Like a Box of Chocolates
JavaScript - Like a Box of ChocolatesRobert Nyman
 
Defensive programming in Javascript and Node.js
Defensive programming in Javascript and Node.jsDefensive programming in Javascript and Node.js
Defensive programming in Javascript and Node.jsRuben Tan
 
Beyond the Callback: Yield Control with Javascript Generators
Beyond the Callback: Yield Control with Javascript GeneratorsBeyond the Callback: Yield Control with Javascript Generators
Beyond the Callback: Yield Control with Javascript GeneratorsDarren Cruse
 
Ejemplo radio
Ejemplo radioEjemplo radio
Ejemplo radiolupe ga
 
Orchestrated Functional Testing with Puppet-spec and Mspectator - PuppetConf ...
Orchestrated Functional Testing with Puppet-spec and Mspectator - PuppetConf ...Orchestrated Functional Testing with Puppet-spec and Mspectator - PuppetConf ...
Orchestrated Functional Testing with Puppet-spec and Mspectator - PuppetConf ...Puppet
 
The Ring programming language version 1.10 book - Part 92 of 212
The Ring programming language version 1.10 book - Part 92 of 212The Ring programming language version 1.10 book - Part 92 of 212
The Ring programming language version 1.10 book - Part 92 of 212Mahmoud Samir Fayed
 
Test Driven Development with Puppet - PuppetConf 2014
Test Driven Development with Puppet - PuppetConf 2014Test Driven Development with Puppet - PuppetConf 2014
Test Driven Development with Puppet - PuppetConf 2014Puppet
 
Alessandro sf 2010
Alessandro sf 2010Alessandro sf 2010
Alessandro sf 2010Puppet
 
Hear no evil, see no evil, patch no evil: Or, how to monkey-patch safely.
Hear no evil, see no evil, patch no evil: Or, how to monkey-patch safely.Hear no evil, see no evil, patch no evil: Or, how to monkey-patch safely.
Hear no evil, see no evil, patch no evil: Or, how to monkey-patch safely.Graham Dumpleton
 

Was ist angesagt? (13)

Mangling
Mangling Mangling
Mangling
 
JavaScript - Like a Box of Chocolates
JavaScript - Like a Box of ChocolatesJavaScript - Like a Box of Chocolates
JavaScript - Like a Box of Chocolates
 
Defensive programming in Javascript and Node.js
Defensive programming in Javascript and Node.jsDefensive programming in Javascript and Node.js
Defensive programming in Javascript and Node.js
 
Beyond the Callback: Yield Control with Javascript Generators
Beyond the Callback: Yield Control with Javascript GeneratorsBeyond the Callback: Yield Control with Javascript Generators
Beyond the Callback: Yield Control with Javascript Generators
 
Ejemplo radio
Ejemplo radioEjemplo radio
Ejemplo radio
 
Hadoop
HadoopHadoop
Hadoop
 
Orchestrated Functional Testing with Puppet-spec and Mspectator - PuppetConf ...
Orchestrated Functional Testing with Puppet-spec and Mspectator - PuppetConf ...Orchestrated Functional Testing with Puppet-spec and Mspectator - PuppetConf ...
Orchestrated Functional Testing with Puppet-spec and Mspectator - PuppetConf ...
 
The Ring programming language version 1.10 book - Part 92 of 212
The Ring programming language version 1.10 book - Part 92 of 212The Ring programming language version 1.10 book - Part 92 of 212
The Ring programming language version 1.10 book - Part 92 of 212
 
Tomorrow Java
Tomorrow JavaTomorrow Java
Tomorrow Java
 
Test Driven Development with Puppet - PuppetConf 2014
Test Driven Development with Puppet - PuppetConf 2014Test Driven Development with Puppet - PuppetConf 2014
Test Driven Development with Puppet - PuppetConf 2014
 
Puppet and Openshift
Puppet and OpenshiftPuppet and Openshift
Puppet and Openshift
 
Alessandro sf 2010
Alessandro sf 2010Alessandro sf 2010
Alessandro sf 2010
 
Hear no evil, see no evil, patch no evil: Or, how to monkey-patch safely.
Hear no evil, see no evil, patch no evil: Or, how to monkey-patch safely.Hear no evil, see no evil, patch no evil: Or, how to monkey-patch safely.
Hear no evil, see no evil, patch no evil: Or, how to monkey-patch safely.
 

Andere mochten auch

Puppet and AWS is Easy...?
Puppet and AWS is Easy...?Puppet and AWS is Easy...?
Puppet and AWS is Easy...?Puppet
 
Puppet control-repo 
to the next level
Puppet control-repo 
to the next levelPuppet control-repo 
to the next level
Puppet control-repo 
to the next levelAlessandro Franceschi
 
PuppetConf 2016: Site Launch Automation: From Days to Minutes – Kristen Crawf...
PuppetConf 2016: Site Launch Automation: From Days to Minutes – Kristen Crawf...PuppetConf 2016: Site Launch Automation: From Days to Minutes – Kristen Crawf...
PuppetConf 2016: Site Launch Automation: From Days to Minutes – Kristen Crawf...Puppet
 
Jenkins Workflow Webinar - Dec 10, 2014
Jenkins Workflow Webinar - Dec 10, 2014Jenkins Workflow Webinar - Dec 10, 2014
Jenkins Workflow Webinar - Dec 10, 2014CloudBees
 
High availability for puppet - 2016
High availability for puppet - 2016High availability for puppet - 2016
High availability for puppet - 2016Zack Smith
 
PuppetConf 2016: Enjoying the Journey from Puppet 3.x to 4.x – Rob Nelson, AT&T
PuppetConf 2016: Enjoying the Journey from Puppet 3.x to 4.x – Rob Nelson, AT&T PuppetConf 2016: Enjoying the Journey from Puppet 3.x to 4.x – Rob Nelson, AT&T
PuppetConf 2016: Enjoying the Journey from Puppet 3.x to 4.x – Rob Nelson, AT&T Puppet
 
PuppetConf 2016: Case Study: Puppets in the Government – Kathy Lee (co-author...
PuppetConf 2016: Case Study: Puppets in the Government – Kathy Lee (co-author...PuppetConf 2016: Case Study: Puppets in the Government – Kathy Lee (co-author...
PuppetConf 2016: Case Study: Puppets in the Government – Kathy Lee (co-author...Puppet
 
PuppetConf 2016: Debugging Diversity – Anjuan Simmons, Assemble Systems
PuppetConf 2016: Debugging Diversity – Anjuan Simmons, Assemble SystemsPuppetConf 2016: Debugging Diversity – Anjuan Simmons, Assemble Systems
PuppetConf 2016: Debugging Diversity – Anjuan Simmons, Assemble SystemsPuppet
 
PuppetConf. 2016: External Data in Puppet 4 – R.I. Pienaar
PuppetConf. 2016: External Data in Puppet 4 – R.I. PienaarPuppetConf. 2016: External Data in Puppet 4 – R.I. Pienaar
PuppetConf. 2016: External Data in Puppet 4 – R.I. PienaarPuppet
 
PuppetConf 2016: Puppet Troubleshooting – Thomas Uphill, Wells Fargo
PuppetConf 2016: Puppet Troubleshooting – Thomas Uphill, Wells FargoPuppetConf 2016: Puppet Troubleshooting – Thomas Uphill, Wells Fargo
PuppetConf 2016: Puppet Troubleshooting – Thomas Uphill, Wells FargoPuppet
 
PuppetConf 2016: High Availability for Puppet – Russ Mull & Zack Smith, Puppet
PuppetConf 2016: High Availability for Puppet – Russ Mull & Zack Smith, PuppetPuppetConf 2016: High Availability for Puppet – Russ Mull & Zack Smith, Puppet
PuppetConf 2016: High Availability for Puppet – Russ Mull & Zack Smith, PuppetPuppet
 
PuppetConf. 2016: Puppet Best Practices: Roles & Profiles – Gary Larizza, Puppet
PuppetConf. 2016: Puppet Best Practices: Roles & Profiles – Gary Larizza, PuppetPuppetConf. 2016: Puppet Best Practices: Roles & Profiles – Gary Larizza, Puppet
PuppetConf. 2016: Puppet Best Practices: Roles & Profiles – Gary Larizza, PuppetPuppet
 
PuppetConf 2016: Successful Puppet Implementation in Large Organizations – Ja...
PuppetConf 2016: Successful Puppet Implementation in Large Organizations – Ja...PuppetConf 2016: Successful Puppet Implementation in Large Organizations – Ja...
PuppetConf 2016: Successful Puppet Implementation in Large Organizations – Ja...Puppet
 
Managing a R&D Lab with Foreman
Managing a R&D Lab with ForemanManaging a R&D Lab with Foreman
Managing a R&D Lab with ForemanJulien Pivotto
 

Andere mochten auch (16)

Tp install anything
Tp install anythingTp install anything
Tp install anything
 
Puppet and AWS is Easy...?
Puppet and AWS is Easy...?Puppet and AWS is Easy...?
Puppet and AWS is Easy...?
 
Puppet control-repo 
to the next level
Puppet control-repo 
to the next levelPuppet control-repo 
to the next level
Puppet control-repo 
to the next level
 
PuppetConf 2016: Site Launch Automation: From Days to Minutes – Kristen Crawf...
PuppetConf 2016: Site Launch Automation: From Days to Minutes – Kristen Crawf...PuppetConf 2016: Site Launch Automation: From Days to Minutes – Kristen Crawf...
PuppetConf 2016: Site Launch Automation: From Days to Minutes – Kristen Crawf...
 
Nantes M1 Meraud
Nantes M1 MeraudNantes M1 Meraud
Nantes M1 Meraud
 
Jenkins Workflow Webinar - Dec 10, 2014
Jenkins Workflow Webinar - Dec 10, 2014Jenkins Workflow Webinar - Dec 10, 2014
Jenkins Workflow Webinar - Dec 10, 2014
 
High availability for puppet - 2016
High availability for puppet - 2016High availability for puppet - 2016
High availability for puppet - 2016
 
PuppetConf 2016: Enjoying the Journey from Puppet 3.x to 4.x – Rob Nelson, AT&T
PuppetConf 2016: Enjoying the Journey from Puppet 3.x to 4.x – Rob Nelson, AT&T PuppetConf 2016: Enjoying the Journey from Puppet 3.x to 4.x – Rob Nelson, AT&T
PuppetConf 2016: Enjoying the Journey from Puppet 3.x to 4.x – Rob Nelson, AT&T
 
PuppetConf 2016: Case Study: Puppets in the Government – Kathy Lee (co-author...
PuppetConf 2016: Case Study: Puppets in the Government – Kathy Lee (co-author...PuppetConf 2016: Case Study: Puppets in the Government – Kathy Lee (co-author...
PuppetConf 2016: Case Study: Puppets in the Government – Kathy Lee (co-author...
 
PuppetConf 2016: Debugging Diversity – Anjuan Simmons, Assemble Systems
PuppetConf 2016: Debugging Diversity – Anjuan Simmons, Assemble SystemsPuppetConf 2016: Debugging Diversity – Anjuan Simmons, Assemble Systems
PuppetConf 2016: Debugging Diversity – Anjuan Simmons, Assemble Systems
 
PuppetConf. 2016: External Data in Puppet 4 – R.I. Pienaar
PuppetConf. 2016: External Data in Puppet 4 – R.I. PienaarPuppetConf. 2016: External Data in Puppet 4 – R.I. Pienaar
PuppetConf. 2016: External Data in Puppet 4 – R.I. Pienaar
 
PuppetConf 2016: Puppet Troubleshooting – Thomas Uphill, Wells Fargo
PuppetConf 2016: Puppet Troubleshooting – Thomas Uphill, Wells FargoPuppetConf 2016: Puppet Troubleshooting – Thomas Uphill, Wells Fargo
PuppetConf 2016: Puppet Troubleshooting – Thomas Uphill, Wells Fargo
 
PuppetConf 2016: High Availability for Puppet – Russ Mull & Zack Smith, Puppet
PuppetConf 2016: High Availability for Puppet – Russ Mull & Zack Smith, PuppetPuppetConf 2016: High Availability for Puppet – Russ Mull & Zack Smith, Puppet
PuppetConf 2016: High Availability for Puppet – Russ Mull & Zack Smith, Puppet
 
PuppetConf. 2016: Puppet Best Practices: Roles & Profiles – Gary Larizza, Puppet
PuppetConf. 2016: Puppet Best Practices: Roles & Profiles – Gary Larizza, PuppetPuppetConf. 2016: Puppet Best Practices: Roles & Profiles – Gary Larizza, Puppet
PuppetConf. 2016: Puppet Best Practices: Roles & Profiles – Gary Larizza, Puppet
 
PuppetConf 2016: Successful Puppet Implementation in Large Organizations – Ja...
PuppetConf 2016: Successful Puppet Implementation in Large Organizations – Ja...PuppetConf 2016: Successful Puppet Implementation in Large Organizations – Ja...
PuppetConf 2016: Successful Puppet Implementation in Large Organizations – Ja...
 
Managing a R&D Lab with Foreman
Managing a R&D Lab with ForemanManaging a R&D Lab with Foreman
Managing a R&D Lab with Foreman
 

Ähnlich wie PuppetConf 2016: Deconfiguration Management: Making Puppet Clean Up Its Own Mess – Josh Snyder, Yelp

Developing IT infrastructures with Puppet
Developing IT infrastructures with PuppetDeveloping IT infrastructures with Puppet
Developing IT infrastructures with PuppetAlessandro Franceschi
 
How to build your own OpenStack distro using Puppet OpenStack
How to build your own OpenStack distro using Puppet OpenStackHow to build your own OpenStack distro using Puppet OpenStack
How to build your own OpenStack distro using Puppet OpenStackOpenStack
 
Puppet for dummies - PHPBenelux UG edition
Puppet for dummies - PHPBenelux UG editionPuppet for dummies - PHPBenelux UG edition
Puppet for dummies - PHPBenelux UG editionJoshua Thijssen
 
Installaling Puppet Master and Agent
Installaling Puppet Master and AgentInstallaling Puppet Master and Agent
Installaling Puppet Master and AgentRanjit Avasarala
 
Puppet Loves RSpec, Why You Should, Too
Puppet Loves RSpec, Why You Should, TooPuppet Loves RSpec, Why You Should, Too
Puppet Loves RSpec, Why You Should, TooPuppet
 
Puppet loves RSpec, why you should, too
Puppet loves RSpec, why you should, tooPuppet loves RSpec, why you should, too
Puppet loves RSpec, why you should, tooDennis Rowe
 
Puppet Deployment at OnApp
Puppet Deployment at OnApp Puppet Deployment at OnApp
Puppet Deployment at OnApp Puppet
 
PuppetCamp SEA 1 - Puppet Deployment at OnApp
PuppetCamp SEA 1 - Puppet Deployment  at OnAppPuppetCamp SEA 1 - Puppet Deployment  at OnApp
PuppetCamp SEA 1 - Puppet Deployment at OnAppOlinData
 
PuppetCamp SEA 1 - Puppet Deployment at OnApp
PuppetCamp SEA 1 - Puppet Deployment  at OnAppPuppetCamp SEA 1 - Puppet Deployment  at OnApp
PuppetCamp SEA 1 - Puppet Deployment at OnAppWalter Heck
 
Building Docker images with Puppet
Building Docker images with PuppetBuilding Docker images with Puppet
Building Docker images with PuppetNick Jones
 
Writing & Sharing Great Modules on the Puppet Forge
Writing & Sharing Great Modules on the Puppet ForgeWriting & Sharing Great Modules on the Puppet Forge
Writing & Sharing Great Modules on the Puppet ForgePuppet
 
Scalable Systems Management with Puppet
Scalable Systems Management with PuppetScalable Systems Management with Puppet
Scalable Systems Management with PuppetPuppet
 
Scalable systems management with puppet
Scalable systems management with puppetScalable systems management with puppet
Scalable systems management with puppetPuppet
 
Sock Puppets: Growing Your Puppet Codebase
Sock Puppets: Growing Your Puppet CodebaseSock Puppets: Growing Your Puppet Codebase
Sock Puppets: Growing Your Puppet CodebasePuppet
 
Linux Troubleshooting
Linux TroubleshootingLinux Troubleshooting
Linux TroubleshootingKeith Wright
 
Ubuntu Practice and Configuration
Ubuntu Practice and ConfigurationUbuntu Practice and Configuration
Ubuntu Practice and ConfigurationManoj Sahu
 
Puppet without Root - PuppetConf 2013
Puppet without Root - PuppetConf 2013Puppet without Root - PuppetConf 2013
Puppet without Root - PuppetConf 2013Puppet
 
How I hack on puppet modules
How I hack on puppet modulesHow I hack on puppet modules
How I hack on puppet modulesKris Buytaert
 

Ähnlich wie PuppetConf 2016: Deconfiguration Management: Making Puppet Clean Up Its Own Mess – Josh Snyder, Yelp (20)

Developing IT infrastructures with Puppet
Developing IT infrastructures with PuppetDeveloping IT infrastructures with Puppet
Developing IT infrastructures with Puppet
 
How to build your own OpenStack distro using Puppet OpenStack
How to build your own OpenStack distro using Puppet OpenStackHow to build your own OpenStack distro using Puppet OpenStack
How to build your own OpenStack distro using Puppet OpenStack
 
Puppet quick start guide
Puppet quick start guidePuppet quick start guide
Puppet quick start guide
 
Puppet for dummies - PHPBenelux UG edition
Puppet for dummies - PHPBenelux UG editionPuppet for dummies - PHPBenelux UG edition
Puppet for dummies - PHPBenelux UG edition
 
Installaling Puppet Master and Agent
Installaling Puppet Master and AgentInstallaling Puppet Master and Agent
Installaling Puppet Master and Agent
 
Puppet Loves RSpec, Why You Should, Too
Puppet Loves RSpec, Why You Should, TooPuppet Loves RSpec, Why You Should, Too
Puppet Loves RSpec, Why You Should, Too
 
Puppet loves RSpec, why you should, too
Puppet loves RSpec, why you should, tooPuppet loves RSpec, why you should, too
Puppet loves RSpec, why you should, too
 
Puppet Deployment at OnApp
Puppet Deployment at OnApp Puppet Deployment at OnApp
Puppet Deployment at OnApp
 
PuppetCamp SEA 1 - Puppet Deployment at OnApp
PuppetCamp SEA 1 - Puppet Deployment  at OnAppPuppetCamp SEA 1 - Puppet Deployment  at OnApp
PuppetCamp SEA 1 - Puppet Deployment at OnApp
 
PuppetCamp SEA 1 - Puppet Deployment at OnApp
PuppetCamp SEA 1 - Puppet Deployment  at OnAppPuppetCamp SEA 1 - Puppet Deployment  at OnApp
PuppetCamp SEA 1 - Puppet Deployment at OnApp
 
Building Docker images with Puppet
Building Docker images with PuppetBuilding Docker images with Puppet
Building Docker images with Puppet
 
Writing & Sharing Great Modules on the Puppet Forge
Writing & Sharing Great Modules on the Puppet ForgeWriting & Sharing Great Modules on the Puppet Forge
Writing & Sharing Great Modules on the Puppet Forge
 
Scalable Systems Management with Puppet
Scalable Systems Management with PuppetScalable Systems Management with Puppet
Scalable Systems Management with Puppet
 
Scalable systems management with puppet
Scalable systems management with puppetScalable systems management with puppet
Scalable systems management with puppet
 
Sock Puppets: Growing Your Puppet Codebase
Sock Puppets: Growing Your Puppet CodebaseSock Puppets: Growing Your Puppet Codebase
Sock Puppets: Growing Your Puppet Codebase
 
Sock puppets
Sock puppetsSock puppets
Sock puppets
 
Linux Troubleshooting
Linux TroubleshootingLinux Troubleshooting
Linux Troubleshooting
 
Ubuntu Practice and Configuration
Ubuntu Practice and ConfigurationUbuntu Practice and Configuration
Ubuntu Practice and Configuration
 
Puppet without Root - PuppetConf 2013
Puppet without Root - PuppetConf 2013Puppet without Root - PuppetConf 2013
Puppet without Root - PuppetConf 2013
 
How I hack on puppet modules
How I hack on puppet modulesHow I hack on puppet modules
How I hack on puppet modules
 

Mehr von Puppet

Puppet camp2021 testing modules and controlrepo
Puppet camp2021 testing modules and controlrepoPuppet camp2021 testing modules and controlrepo
Puppet camp2021 testing modules and controlrepoPuppet
 
Puppetcamp r10kyaml
Puppetcamp r10kyamlPuppetcamp r10kyaml
Puppetcamp r10kyamlPuppet
 
2021 04-15 operational verification (with notes)
2021 04-15 operational verification (with notes)2021 04-15 operational verification (with notes)
2021 04-15 operational verification (with notes)Puppet
 
Puppet camp vscode
Puppet camp vscodePuppet camp vscode
Puppet camp vscodePuppet
 
Modules of the twenties
Modules of the twentiesModules of the twenties
Modules of the twentiesPuppet
 
Applying Roles and Profiles method to compliance code
Applying Roles and Profiles method to compliance codeApplying Roles and Profiles method to compliance code
Applying Roles and Profiles method to compliance codePuppet
 
KGI compliance as-code approach
KGI compliance as-code approachKGI compliance as-code approach
KGI compliance as-code approachPuppet
 
Enforce compliance policy with model-driven automation
Enforce compliance policy with model-driven automationEnforce compliance policy with model-driven automation
Enforce compliance policy with model-driven automationPuppet
 
Keynote: Puppet camp compliance
Keynote: Puppet camp complianceKeynote: Puppet camp compliance
Keynote: Puppet camp compliancePuppet
 
Automating it management with Puppet + ServiceNow
Automating it management with Puppet + ServiceNowAutomating it management with Puppet + ServiceNow
Automating it management with Puppet + ServiceNowPuppet
 
Puppet: The best way to harden Windows
Puppet: The best way to harden WindowsPuppet: The best way to harden Windows
Puppet: The best way to harden WindowsPuppet
 
Simplified Patch Management with Puppet - Oct. 2020
Simplified Patch Management with Puppet - Oct. 2020Simplified Patch Management with Puppet - Oct. 2020
Simplified Patch Management with Puppet - Oct. 2020Puppet
 
Accelerating azure adoption with puppet
Accelerating azure adoption with puppetAccelerating azure adoption with puppet
Accelerating azure adoption with puppetPuppet
 
Puppet catalog Diff; Raphael Pinson
Puppet catalog Diff; Raphael PinsonPuppet catalog Diff; Raphael Pinson
Puppet catalog Diff; Raphael PinsonPuppet
 
ServiceNow and Puppet- better together, Kevin Reeuwijk
ServiceNow and Puppet- better together, Kevin ReeuwijkServiceNow and Puppet- better together, Kevin Reeuwijk
ServiceNow and Puppet- better together, Kevin ReeuwijkPuppet
 
Take control of your dev ops dumping ground
Take control of your  dev ops dumping groundTake control of your  dev ops dumping ground
Take control of your dev ops dumping groundPuppet
 
100% Puppet Cloud Deployment of Legacy Software
100% Puppet Cloud Deployment of Legacy Software100% Puppet Cloud Deployment of Legacy Software
100% Puppet Cloud Deployment of Legacy SoftwarePuppet
 
Puppet User Group
Puppet User GroupPuppet User Group
Puppet User GroupPuppet
 
Continuous Compliance and DevSecOps
Continuous Compliance and DevSecOpsContinuous Compliance and DevSecOps
Continuous Compliance and DevSecOpsPuppet
 
The Dynamic Duo of Puppet and Vault tame SSL Certificates, Nick Maludy
The Dynamic Duo of Puppet and Vault tame SSL Certificates, Nick MaludyThe Dynamic Duo of Puppet and Vault tame SSL Certificates, Nick Maludy
The Dynamic Duo of Puppet and Vault tame SSL Certificates, Nick MaludyPuppet
 

Mehr von Puppet (20)

Puppet camp2021 testing modules and controlrepo
Puppet camp2021 testing modules and controlrepoPuppet camp2021 testing modules and controlrepo
Puppet camp2021 testing modules and controlrepo
 
Puppetcamp r10kyaml
Puppetcamp r10kyamlPuppetcamp r10kyaml
Puppetcamp r10kyaml
 
2021 04-15 operational verification (with notes)
2021 04-15 operational verification (with notes)2021 04-15 operational verification (with notes)
2021 04-15 operational verification (with notes)
 
Puppet camp vscode
Puppet camp vscodePuppet camp vscode
Puppet camp vscode
 
Modules of the twenties
Modules of the twentiesModules of the twenties
Modules of the twenties
 
Applying Roles and Profiles method to compliance code
Applying Roles and Profiles method to compliance codeApplying Roles and Profiles method to compliance code
Applying Roles and Profiles method to compliance code
 
KGI compliance as-code approach
KGI compliance as-code approachKGI compliance as-code approach
KGI compliance as-code approach
 
Enforce compliance policy with model-driven automation
Enforce compliance policy with model-driven automationEnforce compliance policy with model-driven automation
Enforce compliance policy with model-driven automation
 
Keynote: Puppet camp compliance
Keynote: Puppet camp complianceKeynote: Puppet camp compliance
Keynote: Puppet camp compliance
 
Automating it management with Puppet + ServiceNow
Automating it management with Puppet + ServiceNowAutomating it management with Puppet + ServiceNow
Automating it management with Puppet + ServiceNow
 
Puppet: The best way to harden Windows
Puppet: The best way to harden WindowsPuppet: The best way to harden Windows
Puppet: The best way to harden Windows
 
Simplified Patch Management with Puppet - Oct. 2020
Simplified Patch Management with Puppet - Oct. 2020Simplified Patch Management with Puppet - Oct. 2020
Simplified Patch Management with Puppet - Oct. 2020
 
Accelerating azure adoption with puppet
Accelerating azure adoption with puppetAccelerating azure adoption with puppet
Accelerating azure adoption with puppet
 
Puppet catalog Diff; Raphael Pinson
Puppet catalog Diff; Raphael PinsonPuppet catalog Diff; Raphael Pinson
Puppet catalog Diff; Raphael Pinson
 
ServiceNow and Puppet- better together, Kevin Reeuwijk
ServiceNow and Puppet- better together, Kevin ReeuwijkServiceNow and Puppet- better together, Kevin Reeuwijk
ServiceNow and Puppet- better together, Kevin Reeuwijk
 
Take control of your dev ops dumping ground
Take control of your  dev ops dumping groundTake control of your  dev ops dumping ground
Take control of your dev ops dumping ground
 
100% Puppet Cloud Deployment of Legacy Software
100% Puppet Cloud Deployment of Legacy Software100% Puppet Cloud Deployment of Legacy Software
100% Puppet Cloud Deployment of Legacy Software
 
Puppet User Group
Puppet User GroupPuppet User Group
Puppet User Group
 
Continuous Compliance and DevSecOps
Continuous Compliance and DevSecOpsContinuous Compliance and DevSecOps
Continuous Compliance and DevSecOps
 
The Dynamic Duo of Puppet and Vault tame SSL Certificates, Nick Maludy
The Dynamic Duo of Puppet and Vault tame SSL Certificates, Nick MaludyThe Dynamic Duo of Puppet and Vault tame SSL Certificates, Nick Maludy
The Dynamic Duo of Puppet and Vault tame SSL Certificates, Nick Maludy
 

Kürzlich hochgeladen

The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 

Kürzlich hochgeladen (20)

The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 

PuppetConf 2016: Deconfiguration Management: Making Puppet Clean Up Its Own Mess – Josh Snyder, Yelp

  • 2. WHAT'S THE PROBLEM? We use Puppet We change things
  • 3. I have been known to deploy 20 times daily And Puppet runs every 30 minutes
  • 4. That thing you deployed in a hurry isn't always in the place it should be long term. Or...we deploy a thing, and decide next week (or tomorrow) that it isn't right for us Or we just straight-up make mistakes Or our coworkers make mistakes git revertcan't save me
  • 5. My colleague sends me a PR to deploy memcached config files under a new path. Should I comment on their failure to clean up the old ones? YES!
  • 6. But they're busy But I'm busy And I really want to get home to make dinner
  • 7. WHAT ARE OUR OPTIONS?
  • 8. IGNORE THE PROBLEM Ignore it! It probably won't hurt anything Except it will confuse people. It WILL confuse you, at two AM JVM versions will exist on some older dev machines, but not newer ones
  • 9. WRITE CODE TO CLEAN UP AFTER OTHER CODE file { '/etc/memcached.conf': ensure => absent, }
  • 10. ENSEMBLES OF RESOURCES GET COMPLEX if $ensure == 'present' { file { '/etc/init/memcached.conf': ensure => 'file', ... } } else { file { '/etc/init/memcached.conf': ensure => 'absent', ... } }
  • 11. NO FUN AT ALL more code to write more code to review my cleanup code might be broken someone has to clean up the cleanup code
  • 12. WRITE MORE CODE (IN A DIFFERENT LANGUAGE) Use Ansible clean up a er Puppet?
  • 13. REBUILD MACHINES Good! Cattle, not pets I'm deploying new changes every 30 minutes We only clean things up every day? 30 days? 60 days? Five years? ∃ an impedance and tooling mismatch
  • 14. IMMUTABLE IMAGES A more aggressive version of rebuilding machines Use if it suits you
  • 15. THE SOLUTION (TO ALL YOUR PROBLEMS) 1. Use Puppet to specify what should be deployed 2. Allow Puppet to remove anything it doesn't know about
  • 16. WHAT'S TO COME? A few basic examples (directory purging, cronjobs, hosts) A bit of Puppet internals Use Puppet internals to achieve more purging
  • 18. DIRECTORY PURGING file { '/etc/cassandra': ensure => 'directory', recurse => true, purge => true, force => true, ... }
  • 19. WHAT WILL THIS DO? Use puppet agent --noop Or add  noop => true Look at the system: $ ls /etc/cassandra ... $ dpkg -S /etc/cassandra ...
  • 20. EXAMPLE 1: PARTIAL MANAGEMENT Situation: We want to purge /etc/cassandra, but we need to generate the list of seeds outside of Puppet file { '/etc/cassandra': ensure => directory, recurse => true, purge => true, force => true, ... } file { '/etc/cassandra/seeds': ensure => file, replace => false, ... }
  • 21. EXAMPLE 2: CRONJOBS Lots of cronjobs Lots of cronjobs! Using Yelp's One file per job in /etc/cron.d puppet-cron
  • 22. PURGING CRONJOBS Problem: purge => truewould wipe out crons provided by Debian packages.
  • 23. Option ImplicationsOption Implications Recompile cron to read from a supplemental directory Anyone else using would have to use our patched cron Create Fileresources for each file we expect a from a deb. Whenever someone installs a package with a new cronjob in it, they'd get a nasty surprise Find some way to identify those cronjobs that were originally created by Puppet Good puppet-cron
  • 24. What this solution ends up looking like: (ish) file { '/nail/etc/cron.d': ensure => directory, purge => true, force => true, recurse => true, } file { '/nail/etc/cron.d/myjob': ensure => file, ... } -> file { '/etc/cron.d/myjob': ensure => link, target => '/nail/etc/cron.d/myjob', } github.com/Yelp/puppet-cron
  • 25. EXAMPLE 3: /ETC/HOSTS Puppet agent has a RAL (resource abstraction layer) RAL is responsible for representing resources on the system as Puppet Resource objects $ puppet resource host host { 'ip6-allnodes': ensure => 'present', ip => 'ff02::1', target => '/etc/hosts', } host { 'ip6-allrouters': ensure => 'present', ip => 'ff02::2', target => '/etc/hosts', } host { 'localhost': ensure => 'present',
  • 26. Puppet diffs resources in the catalog against the RAL it constructs Could we ask it remove resources present in the RAL but not in the catalog? YES!
  • 27. IT'S THIS SIMPLE resources { 'host': purge => true, } Use noop => trueto try before you buy
  • 28. HOW IT WORKS All on the agent, a er catalog compilation Iterate over resources, calling the generateor eval_generate method on each. Each resource has the opportunity to add more resources to the Puppet run.
  • 29. Walkthrough: fetching files from a fileserver file { '/etc/cassandra': ensure => directory, source => 'puppet:///modules/cassandra/config_dir', recurse => true, purge => true, force => true, } 1. Get catalog with this resource declared 2. Puppet agent calls eval_generateon this resource 3. eval_generateexamines the disk, compares it with the Puppet fileserver 4. Generates more resources to represent the files beneath this directory
  • 30. HOW THE RESOURCESTYPE WORKS resources { 'host': purge => true, } 1. Puppet calls generate 2. Generate finds all resources of type Hostin the catalog 3. Asks providers of Hostfor their instances 4. Compare the two 5. Emit new resources: host { 'ip6-allnodes': ensure => absent, }
  • 31. MOVING BEYOND THE BUILTINS
  • 32. PURGING UNDESIRED DEBIAN PACKAGES Let's say I do: resources { 'package': purge => true, } This happens: Notice: /Stage[main]/Main/Package[libxtst6]/ensure: current_value Notice: /Stage[main]/Main/Package[libxcb-dri3-0]/ensure: current_va Notice: /Stage[main]/Main/Package[powermgmt-base]/ensure: current_v Notice: /Stage[main]/Main/Package[python3-py]/ensure: current_value Notice: /Stage[main]/Main/Package[libtk8.6]/ensure: current_value Notice: /Stage[main]/Main/Package[node-ansi-color-table]/ensure: Notice: /Stage[main]/Main/Package[libxpp3-java]/ensure: current_val Notice: /Stage[main]/Main/Package[python3-newt]/ensure: current_val Notice: /Stage[main]/Main/Package[bsdmainutils]/ensure: current_val Notice: /Stage[main]/Main/Package[libpulse0]/ensure: current_value Notice: /Stage[main]/Main/Package[liblvm2app2.2]/ensure: current_va
  • 33. NO BUENO Why doesn't puppet understand that it should remove all packages that: aren't in the catalog no other package depends on
  • 34. We need to be dependency-aware What removes packages and is dependency aware? apt-get autoremove
  • 35. APT-GET AUTOREMOVE Divides packages into: manually installed (we're sure we want this) auto installed (a dependency)
  • 36. THIS MAPS WELL TO PUPPET puppet state ⇒ autoremover state puppet state ⇒ autoremover state in catalog manually installed not in catalog automatically installed
  • 37. AN IMPLEMENTATION COMES TOGETHER 1. Synchronize the autoremover database with the Puppet catalog 2. Run apt-get autoremove 3. Problem?
  • 38. AN IMPLEMENTATION COMES TOGETHER (PARTE DUEX) 1. Synchronize the autoremover database with the Puppet catalog 2. Run apt-get -s autoremove 3. Read the output and create Puppet package resources 4. Much rejoicing! github.com/hashbrowncipher/puppet-package_purging
  • 39. GENERAL PURPOSE SOLUTIONS? Could there be a jack-of-all-trades solution to purging? What if we could do: purge { 'user': unless => [ 'uid', '<=', '500' ], } It exists: github.com/crayfishx/puppet-purge
  • 41. NOT MY FAVORITE DEFAULT Q: What does this do? package { 'mysql-server-5.7': } package { 'bash': } A: Creates version dri
  • 42. UPGRADE (SOME OF THE) THINGS package { 'mysql-server-5.7': ensure => $my_favorite_mysql_version } package { 'bash': } aptly_purgecan set all versioned packages as held by dpkg aptly_purge { 'packages': hold => true, } Upshot: apt-get dist-upgradeand unattended-upgrades will only touch packages without a specific Puppet version specified.
  • 43. END MATTER Please do tell me your stories of Puppet resource purging. Walk up and say hi right now. works toojosh@code406.com in Puppet Community Slack@josnyder