SlideShare ist ein Scribd-Unternehmen logo
1 von 62
Downloaden Sie, um offline zu lesen
PUPPET DESIGN PATTERNS
David Danzilio
Kovarus, Inc.
➀ Architect with Kovarus
➀ Joined in May 2016
➀ Previously at Constant Contact, Sandia
National Laboratories, and a few other
places you’ve never heard of
➀ Operations background, but more of a
developer these days
➀ One of the maintainers of Vox Pupuli
➀ Organizer of the Boston Puppet User
Group
ABOUT ME
ABOUT DESIGN PATTERNS
GANG OF FOUR
➀ Gang of Four (GoF) book introduced the
concept for Object Oriented
programming
➀ 23 patterns with examples written in
C++ and SmallTalk
➀ Published in 1994, more than 500,000
copies sold
➀ One of the best selling software
engineering books in history
➀ InïŹ‚uenced an entire generation of
developers, languages, and tools
DESIGN PATTERNS
➀ Can be highly contextual and language dependent, but a lot can be learned from all
of them
➀ The GoF focused on statically-typed, object oriented, compiled languages
➀ Some languages have implemented primitives for these patterns
➀ Not many of the GoF patterns directly apply to Puppet
➀ All of the GoF patterns focus on reinforcing a set of design principles
WHY DESIGN PATTERNS?
DESIGN PRINCIPLES
SEPARATE THINGS
THAT CHANGE
Minimize risk when making changes
LOOSE COUPLING
Reduce dependencies, increase
modularity
SEPARATION OF
CONCERNS
Divide your application into distinct
features
SINGLE
RESPONSIBILITY
Do one thing well
LEAST
KNOWLEDGE
Components should know as little as
possible about their neighbors
DON’T REPEAT
YOURSELF
DRY, because we’re lazy
PROGRAM TO AN
INTERFACE
Interfaces are more stable than the
implementation
SIX PATTERNS
SIX PATTERNS
➀ Resource Wrapper: adding functionality to code you don’t own
➀ Package, File, Service: breaking up monolithic classes
➀ Params: delegating parameter defaults
➀ Strategy: doing the same thing diïŹ€erently
➀ Roles and ProïŹles: organizing your code for modularity
➀ Factory: creating resources on the ïŹ‚y
THE RESOURCE
WRAPPER
PATTERN
Extending existing resources
ABOUT THE WRAPPER PATTERN
➀ Problem: resources you don’t own are missing some functionality or feature
required to implement your requirements
➀ Solution: use composition to add your required functionality without modifying the
code you don’t own
ABOUT THE WRAPPER PATTERN
➀ Use the resource wrapper pattern when you need to add functionality to an
existing resource
➀ When you feel the need to write your own resources, or to make changes to Forge
modules, think about whether you should really be using the wrapper pattern
➀ You can do this in Puppet 3 and Puppet 4, but it’s much cleaner in Puppet 4
➀ This pattern forms the basis of many other patterns you’ll see today
EXAMPLE: MANAGING USERS
➀ We want to manage our employee user accounts
➀ Requirements:
➀ The user’s UID should be set to their employee ID
➀ All employees need to be members of the ‘employees’ group
➀ We should manage a user’s bash proïŹle by default, but users may opt out of this
upon request
EXAMPLE: MANAGING USERS
define mycompany::user (
$employee_id,
$gid,
$groups = ['employees'],
$username = $title,
$manage_profile = true,
) {
if $manage_profile {
file { "/home/${username}/.bash_profile":
ensure => file,
owner => $username,
require => User[$username],
}
}
user { $username:
uid => $employee_id,
gid => $gid,
groups => $groups,
}
}
All employees should be in the ‘employees’ group
Employee ID is used for the user ID
Feature flag to manage your user’s bash profile
Manage ~/.bash_profile with a file resource
Pass your parameters to the user resource
EXAMPLE: MANAGING USERS
mycompany::user { 'bob':
employee_id => '1093',
gid => 'wheel',
manage_profile => false,
}
“We have a new employee
named Bob. He’s employee
1093 and he needs to be a
member of the wheel group so
he can sudo. He wants to
manage his own bash
profile.”
EXAMPLE: MANAGING USERS
“Hey, I’d like to have my
shell set to /bin/zsh, can you
do that for me?”
mycompany::user { 'bob':
employee_id => '1093',
gid => 'wheel',
shell => '/bin/zsh',
manage_profile => false,
}
Could not retrieve catalog:
Invalid parameter ‘shell’ for
type ‘mycompany::user’
EXAMPLE: MANAGING USERS define mycompany::user (
$employee_id,
$gid,
$groups = ['employees'],
$username = $title,
$manage_profile = true,
) {
if $manage_profile {
file { "/home/${username}/.bash_profile":
ensure => file,
owner => $username,
require => User[$username],
}
}
user { $username:
uid => $employee_id,
gid => $gid,
groups => $groups,
}
}
Problem
You must maintain these parameters.
EXAMPLE: MANAGING USERS (PUPPET 3)
define mycompany::user (
$username = $title,
$manage_profile = true,
$user = {}
) {
if $manage_profile {
file { "/home/${username}/.bash_profile":
ensure => file,
owner => $username,
require => User[$username],
}
}
$user_defaults = { ‘groups’ => [‘employees’] }
$user_params = merge($user, $user_defaults)
create_resources(‘user’, $username, $user_params)
}
Much more flexible interface
Enforce business rules
Create the user resource by passing
the hash to create_resources
EXAMPLE: MANAGING USERS (PUPPET 4)
define mycompany::user (
String $username = $title,
Boolean $manage_profile = true,
Hash $user = {}
) {
if $manage_profile {
file { "/home/${username}/.bash_profile":
ensure => file,
owner => $username,
require => User[$username],
}
}
$user_defaults = { 'groups' => [‘employees’] }
user { $username:
* => $user_defaults + $user,
}
}
Much more flexible interface
Enforce business rules
Use splat operator to pass hash keys
as parameters to the user resource
EXAMPLE: MANAGING USERS
mycompany::user { 'bob':
employee_id => '1093',
gid => 'wheel',
manage_profile => false,
}
“Hey, I’d like to have my
shell set to /bin/zsh, can you
do that for me?”
mycompany::user { 'bob':
manage_profile => false,
user => {
'uid' => '1093',
'gid' => 'wheel',
}
}
EXAMPLE: MANAGING USERS
mycompany::user { 'bob':
employee_id => '1093',
gid => 'wheel',
manage_profile => false,
}
mycompany::user { 'bob':
manage_profile => false,
user => {
'uid' => '1093',
'gid' => 'wheel',
'shell' => '/bin/zsh',
}
}
“Hey, I’d like to have my
shell set to /bin/zsh, can you
do that for me?”
THE PACKAGE/
FILE/SERVICE
PATTERN
Assembling complex behavior
ABOUT THE PACKAGE/FILE/SERVICE PATTERN
➀ Problem: your module’s init.pp is getting too cluttered because all of your code
lives in that one ïŹle
➀ Solution: break out the basic functions of your module into separate classes,
generally into a package, config, and service class
ABOUT THE PACKAGE/FILE/SERVICE PATTERN
➀ This is one of the ïŹrst patterns you see when learning Puppet
➀ This is the embodiment of the Single Responsibility and Separation of Concerns
principles
➀ Most modules can be broken down into some form of Package, ConïŹg File, and
Service management
➀ Use this speciïŹc pattern any time you write a module that manages these things
➀ Keep the spirit of this pattern in mind whenever you write a module that is more
than a few lines long
➀ This has the added beneïŹt of allowing us to utilize class containment for cleaner
resource ordering
EXAMPLE: NTP
class ntp {
case $::osfamily {
'Solaris': {
$package_name = ['SUNWntpr', 'SUNWntpu']
$config_file = '/etc/inet/ntp.conf'
$service_name = 'network/ntp'
}
'RedHat': {
$package_name = 'ntp'
$config_file = '/etc/ntp.conf'
$service_name = 'ntpd'
}
}
package { $package_name:
ensure => installed,
}
file { $config_file:
ensure => file,
content => template('ntp/ntpd.conf.erb'),
require => Package[$package_name],
notify => Service[$service_name],
}
service { $service_name:
ensure => running
}
}
Installs the ntp package for that platform
Places the ntp config file
Ensures that the package is installed first
Notifies the ntp service of changes to the file
Manages the ntp service
Set some variables based on the osfamily fact
class ntp {
case $osfamily {
'Solaris': {
$package_name = ['SUNWntpr', 'SUNWntpu']
$config_file = '/etc/inet/ntp.conf'
$service_name = 'network/ntp'
}
'RedHat': {
$package_name = 'ntp'
$config_file = '/etc/ntp.conf'
$service_name = 'ntpd'
}
}
class { 'ntp::install': } ->
class { 'ntp::config': } ~>
class { 'ntp::service': }
}
EXAMPLE: NTP
Installs the ntp package
Places the ntp config file
Package is installed first
Manages the ntp service
Notifies the service of changes
class ntp::install {
package { $ntp::package_name:
ensure => installed,
}
}
class ntp::config {
file { $ntp::config_file:
ensure => file,
content => template('ntp/ntpd.conf.erb'),
}
}
class ntp::service {
service { $ntp::service_name:
ensure => running,
}
}
EXAMPLE: NTP
THE PARAMS
PATTERN
Separating out your data
ABOUT THE PARAMS PATTERN
➀ Problem: hard-coded data makes modules fragile, verbose parameter default and
variable setting logic make classes hard to read
➀ Solution: convert embedded data to parameters and move that data to a separate
class where it can be used as parameter defaults
ABOUT THE PARAMS PATTERN
➀ The params pattern breaks out your variable assignment and parameter defaults
into a separate class, typically named params
➀ Makes classes easier to read by moving the default setting logic into a purpose-built
class
➀ Delegates responsibility for setting defaults to the params class
➀ Module data is a new feature designed to eliminate the params pattern by moving
this logic into Hiera
➀ Until module data becomes more ubiquitous, you’ll see params in use in almost
every module
➀ Use this pattern any time you have data that must live in your module
EXAMPLE: NTP
Problems
Only supports Solaris and RedHat
~70% of this class is devoted to data
class ntp {
case $osfamily {
'Solaris': {
$package_name = ['SUNWntpr', 'SUNWntpu']
$config_file = '/etc/inet/ntp.conf'
$service_name = 'network/ntp'
}
'RedHat': {
$package_name = 'ntp'
$config_file = '/etc/ntp.conf'
$service_name = 'ntpd'
}
}
class { 'ntp::install': } ->
class { 'ntp::config': } ~>
class { 'ntp::service': }
}
EXAMPLE: NTP
class ntp::params {
case $::osfamily {
'Solaris': {
$package_name = ['SUNWntpr', 'SUNWntpu']
$config_file = '/etc/inet/ntp.conf'
$service_name = 'network/ntp'
}
'RedHat': {
$package_name = 'ntp'
$config_file = '/etc/ntp.conf'
$service_name = 'ntpd'
}
}
}
Create a purpose-built class
to store your module’s data
These variables become the default
values for your class parameters
EXAMPLE: NTP
class ntp (
$package_name = $ntp::params::package_name,
$config_file = $ntp::params::config_file,
$service_name = $ntp::params::service_name,
) inherits ntp::params {
class { 'ntp::install': } ->
class { 'ntp::config': } ~>
class { 'ntp::service': }
}
Inheriting the params class ensures
that it is evaluated first
Convert the variables to parameters, and set
their defaults to the corresponding variables
in the params class
THE STRATEGY
PATTERN
Varying the algorithm
ABOUT THE STRATEGY PATTERN
➀ Problem: you have multiple ways to achieve basically the same thing in your
module, but you need to choose one way based on some criteria (usually a fact)
➀ Solution: break each approach into separate classes and let your caller decide which
to include
ABOUT THE STRATEGY PATTERN
➀ This is a GoF pattern
➀ Use this pattern when you have lots of logic doing eïŹ€ectively the same thing but
with diïŹ€erent details under certain conditions
➀ The Strategy Pattern uses composition to assemble complex behavior from smaller
classes
EXAMPLE: MYSQL
class mysql {
...
case $::osfamily {
'Debian': {
apt::source { 'mysql':
comment => 'MySQL Community APT repository',
location => "http://repo.mysql.com/apt/${::operatingsystem}",
release => $::lsbdistcodename,
repos => 'mysql-5.7',
include => { src => false },
}
}
'RedHat': {
yumrepo { 'mysql':
descr => 'MySQL Community YUM repository',
baseurl => "http://repo.mysql.com/yum/mysql-5.7-community/el/${::lsbmajdistrelease}/${::architecture}",
enabled => true,
}
}
}
...
}
Both managing a package repository
EXAMPLE: MYSQL
class mysql::repo::redhat {
yumrepo { 'mysql':
descr => 'MySQL Community YUM repository',
baseurl => "http://repo.mysql.com/yum/mysql-5.7-community/el/${::lsbmajdistrelease}/${::architecture}",
enabled => true,
}
}
class mysql::repo::debian {
apt::source { 'mysql':
comment => 'MySQL Community APT repository',
location => "http://repo.mysql.com/apt/${::operatingsystem}",
release => $::lsbdistcodename,
repos => 'mysql-5.7',
include => { src => false },
}
}
Strategy Classes
EXAMPLE: MYSQL
class mysql {
...
case $::osfamily {
'Debian': { include mysql::repo::debian }
'RedHat': { include mysql::repo::redhat }
}
...
}
Context Class
Case statement determines
which strategy class to include
THE ROLES AND
PROFILES
PATTERN
Organizing your code for modularity
ABOUT THE ROLES AND PROFILES PATTERN
➀ Problem: large node statements with many classes, lots of inherited node
statements, diïŹƒculty identifying what a server’s purpose is in your environment
➀ Solution: add an extra layer of abstraction between your node and your modules
ABOUT THE ROLES AND PROFILES PATTERN
➀ The Roles and ProïŹles pattern was described by Craig Dunn in his blog post
Designing Puppet - Roles and ProïŹles
➀ This is one of the most comprehensive design patterns for Puppet
➀ It is the “oïŹƒcial” way to structure your Puppet code
➀ You should always use Roles and ProïŹles
➀ Craig does an excellent job describing these concepts in depth, you should read his
blog post here: http://www.craigdunn.org/2012/05/239/
WITHOUT ROLES AND PROFILES node base {
include mycompany::settings
}
node www inherits base {
include apache
include mysql
include php
include nagios::web_server
}
node ns1 inherits base {
include bind
include nagios::bind
bind::zone { ‘example.com': type => master }
}
node ns2 inherits base {
include bind
include nagios::bind
bind::zone { ‘example.com': type => slave }
}
Base node includes common modules
Nodes inherit the base to get common functionality
More specific functionality is added in each node statement
Problems
This file can get really long, really fast
Can violate DRY when you have lots of similar nodes
Edge cases are hard to manage
Node ModulesModules ResourcesResources
ROLES AND PROFILES TERMINOLOGY
➀ Module: implements one piece of software or functionality
➀ ProïŹle: combines modules to implement a stack (i.e. “A LAMP stack includes the
apache, mysql, and php modules”)
➀ Role: combine proïŹles to implement your business rules (i.e. “This server is a web
server”)
➀ A node can only ever include one role
➀ If you think you need to include two roles, you’ve probably just identiïŹed another
role
Node ModulesModules ResourcesResourcesRole ModulesProfiles
CONVERTING TO ROLES AND PROFILES
class roles::base {
include profiles::base
}
class roles::web_server {
include profiles::base
include profiles::lamp
}
class roles::nameserver::master inherits roles::base {
include profiles::bind::master
}
class roles::nameserver::slave inherits roles::base {
include profiles::bind::slave
}
class profiles::base {
include mycompany::settings
}
class profiles::lamp {
include apache
include mysql
include php
include nagios::web_server
}
class profiles::bind ($type = master) {
include bind
bind::zone { 'example.com':
type => $type,
}
}
class profiles::bind::master {
include profiles::bind
}
class profiles::bind::slave {
class { 'profiles::bind':
type => slave,
}
}
CONVERTING TO ROLES AND PROFILES
node www {
include roles::web_server
}
node ns1 {
include roles::nameserver::master
}
node ns2 {
include roles::nameserver::slave
}
node base {
include mycompany::settings
}
node www inherits base {
include apache
include mysql
include php
include nagios::web_server
}
node ns1 inherits base {
include bind
include nagios::bind
bind::zone { ‘example.com': type => master }
}
node ns2 inherits base {
include bind
include nagios::bind
bind::zone { ‘example.com': type => slave }
}
THE FACTORY
PATTERN
Creating resources in your classes
ABOUT THE FACTORY PATTERN
➀ Problem: your module has to create a lot of resources of the same type, or you want
to control how resources are created with your module
➀ Solution: create the resources in your class based on data passed to your parameters
ABOUT THE FACTORY PATTERN
➀ This is also known as the create_resources pattern
➀ Emerged early on as crude iteration support in older Puppet versions
➀ We already saw this in action in the Resource Wrapper Pattern example
➀ Use this pattern when you want your module to have a single entry point, even for
creating your own resources
EXAMPLE: MANAGING CONFIGURATION WITH INI_SETTING
class puppet (
$ca_server = 'puppet-ca.example.com',
$master = 'puppet.example.com',
$pluginsync = true,
$noop = false,
) {
$defaults = { 'path' => '/etc/puppet/puppet.conf' }
$main_section = {
'main/ca_server' => { 'setting' => 'ca_server', 'value' => $ca_server },
'main/server' => { 'setting' => 'server', 'value' => $master },
}
$agent_section = {
'agent/pluginsync' => { 'setting' => 'pluginsync', 'value' => $pluginsync },
'agent/noop' => { 'setting' => 'noop', 'value' => $noop },
}
create_resources('ini_setting', $main_section, merge($defaults, { section => 'main' }))
create_resources('ini_setting', $agent_section, merge($defaults, { section => 'agent' }))
}
Get data from params
Organize the data so
we can consume it
with create_resources
Pass the munged data
to create_resources
EXAMPLE: MANAGING CONFIGURATION WITH INI_SETTING (PUPPET 4)
class puppet (
String $path = '/etc/puppet/puppet.conf',
Hash $main_section = {
'ca_server' => 'puppet-ca.example.com',
'server' => 'puppet.example.com'
},
Hash $agent_section = {
'pluginsync' => true,
'noop' => false,
},
) {
['agent', 'main'].each |$section| {
$data = getvar("${section}_section")
$data.each |$key,$val| {
ini_setting { "${section}/${key}":
path => $path,
section => $section,
setting => $key,
value => $val,
}
}
}
}
Pass a hash for each section
Iterate over each section name
Fetch the variable that holds that section’s data
Iterate over that data, passing it to an
ini_setting resource
THE END
STAY TUNED FOR MORE PATTERNS
CONTACT INFO
➀ @djdanzilio on Twitter
➀ danzilio on Freenode (you can usually
ïŹnd me in #voxpupuli, #puppet-dev, and
#puppet)
➀ danzilio on GitHub and The Forge
➀ ddanzilio (at) kovarus (dot) com
➀ blog.danzil.io
➀ www.kovarus.com

Weitere Àhnliche Inhalte

Was ist angesagt?

Drupal 8 Theme System: The Backend of Frontend
Drupal 8 Theme System: The Backend of FrontendDrupal 8 Theme System: The Backend of Frontend
Drupal 8 Theme System: The Backend of FrontendAcquia
 
PuppetCamp SEA 1 - Version Control with Puppet
PuppetCamp SEA 1 - Version Control with PuppetPuppetCamp SEA 1 - Version Control with Puppet
PuppetCamp SEA 1 - Version Control with PuppetWalter Heck
 
Making Your Capistrano Recipe Book
Making Your Capistrano Recipe BookMaking Your Capistrano Recipe Book
Making Your Capistrano Recipe BookTim Riley
 
Puppet for Java developers - JavaZone NO 2012
Puppet for Java developers - JavaZone NO 2012Puppet for Java developers - JavaZone NO 2012
Puppet for Java developers - JavaZone NO 2012Carlos Sanchez
 
From Dev to DevOps - FOSDEM 2012
From Dev to DevOps - FOSDEM 2012From Dev to DevOps - FOSDEM 2012
From Dev to DevOps - FOSDEM 2012Carlos Sanchez
 
Ansible : what's ansible & use case by REX
Ansible :  what's ansible & use case by REXAnsible :  what's ansible & use case by REX
Ansible : what's ansible & use case by REXSaewoong Lee
 
Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013
Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013
Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013Carlos Sanchez
 
Czym jest webpack i dlaczego chcesz go uĆŒywać?
Czym jest webpack i dlaczego chcesz go uĆŒywać?Czym jest webpack i dlaczego chcesz go uĆŒywać?
Czym jest webpack i dlaczego chcesz go uĆŒywać?Marcin Gajda
 
How to Develop Puppet Modules: From Source to the Forge With Zero Clicks
How to Develop Puppet Modules: From Source to the Forge With Zero ClicksHow to Develop Puppet Modules: From Source to the Forge With Zero Clicks
How to Develop Puppet Modules: From Source to the Forge With Zero ClicksCarlos Sanchez
 
Arbeiten mit distribute, pip und virtualenv
Arbeiten mit distribute, pip und virtualenvArbeiten mit distribute, pip und virtualenv
Arbeiten mit distribute, pip und virtualenvMarkus Zapke-GrĂŒndemann
 
Challenges of container configuration
Challenges of container configurationChallenges of container configuration
Challenges of container configurationlutter
 
DevOps(4) : Ansible(2) - (MOSG)
DevOps(4) : Ansible(2) - (MOSG)DevOps(4) : Ansible(2) - (MOSG)
DevOps(4) : Ansible(2) - (MOSG)Soshi Nemoto
 
20090514 Introducing Puppet To Sasag
20090514 Introducing Puppet To Sasag20090514 Introducing Puppet To Sasag
20090514 Introducing Puppet To Sasaggarrett honeycutt
 
Py conkr 20150829_docker-python
Py conkr 20150829_docker-pythonPy conkr 20150829_docker-python
Py conkr 20150829_docker-pythonEric Ahn
 
Google compute presentation puppet conf
Google compute presentation puppet confGoogle compute presentation puppet conf
Google compute presentation puppet confbodepd
 
Software Defined Datacenter
Software Defined DatacenterSoftware Defined Datacenter
Software Defined DatacenterNETWAYS
 
One click deployment
One click deploymentOne click deployment
One click deploymentAlex Su
 

Was ist angesagt? (20)

Drupal 8 Theme System: The Backend of Frontend
Drupal 8 Theme System: The Backend of FrontendDrupal 8 Theme System: The Backend of Frontend
Drupal 8 Theme System: The Backend of Frontend
 
PuppetCamp SEA 1 - Version Control with Puppet
PuppetCamp SEA 1 - Version Control with PuppetPuppetCamp SEA 1 - Version Control with Puppet
PuppetCamp SEA 1 - Version Control with Puppet
 
Making Your Capistrano Recipe Book
Making Your Capistrano Recipe BookMaking Your Capistrano Recipe Book
Making Your Capistrano Recipe Book
 
Puppet for Java developers - JavaZone NO 2012
Puppet for Java developers - JavaZone NO 2012Puppet for Java developers - JavaZone NO 2012
Puppet for Java developers - JavaZone NO 2012
 
From Dev to DevOps - FOSDEM 2012
From Dev to DevOps - FOSDEM 2012From Dev to DevOps - FOSDEM 2012
From Dev to DevOps - FOSDEM 2012
 
Ansible : what's ansible & use case by REX
Ansible :  what's ansible & use case by REXAnsible :  what's ansible & use case by REX
Ansible : what's ansible & use case by REX
 
Debian Packaging
Debian PackagingDebian Packaging
Debian Packaging
 
Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013
Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013
Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013
 
Czym jest webpack i dlaczego chcesz go uĆŒywać?
Czym jest webpack i dlaczego chcesz go uĆŒywać?Czym jest webpack i dlaczego chcesz go uĆŒywać?
Czym jest webpack i dlaczego chcesz go uĆŒywać?
 
How to Develop Puppet Modules: From Source to the Forge With Zero Clicks
How to Develop Puppet Modules: From Source to the Forge With Zero ClicksHow to Develop Puppet Modules: From Source to the Forge With Zero Clicks
How to Develop Puppet Modules: From Source to the Forge With Zero Clicks
 
Arbeiten mit distribute, pip und virtualenv
Arbeiten mit distribute, pip und virtualenvArbeiten mit distribute, pip und virtualenv
Arbeiten mit distribute, pip und virtualenv
 
Challenges of container configuration
Challenges of container configurationChallenges of container configuration
Challenges of container configuration
 
DevOps(4) : Ansible(2) - (MOSG)
DevOps(4) : Ansible(2) - (MOSG)DevOps(4) : Ansible(2) - (MOSG)
DevOps(4) : Ansible(2) - (MOSG)
 
20090514 Introducing Puppet To Sasag
20090514 Introducing Puppet To Sasag20090514 Introducing Puppet To Sasag
20090514 Introducing Puppet To Sasag
 
Py conkr 20150829_docker-python
Py conkr 20150829_docker-pythonPy conkr 20150829_docker-python
Py conkr 20150829_docker-python
 
Dbdeployer
DbdeployerDbdeployer
Dbdeployer
 
Google compute presentation puppet conf
Google compute presentation puppet confGoogle compute presentation puppet conf
Google compute presentation puppet conf
 
Php on Windows
Php on WindowsPhp on Windows
Php on Windows
 
Software Defined Datacenter
Software Defined DatacenterSoftware Defined Datacenter
Software Defined Datacenter
 
One click deployment
One click deploymentOne click deployment
One click deployment
 

Andere mochten auch

Designing Puppet: Roles/Profiles Pattern
Designing Puppet: Roles/Profiles PatternDesigning Puppet: Roles/Profiles Pattern
Designing Puppet: Roles/Profiles PatternPuppet
 
è‡Șćˆ†ăźć­äŸ›ăźă‚Żăƒ©ă‚čă§ć­ŠçŽšćŽ©ćŁŠăŒè”·ă“ăŁăŸæ™‚ă«ă€äżè­·è€…ăšă—ăŠăŠă‚™ăă‚‹ă“ăš
è‡Șćˆ†ăźć­äŸ›ăźă‚Żăƒ©ă‚čă§ć­ŠçŽšćŽ©ćŁŠăŒè”·ă“ăŁăŸæ™‚ă«ă€äżè­·è€…ăšă—ăŠăŠă‚™ăă‚‹ă“ăšè‡Șćˆ†ăźć­äŸ›ăźă‚Żăƒ©ă‚čă§ć­ŠçŽšćŽ©ćŁŠăŒè”·ă“ăŁăŸæ™‚ă«ă€äżè­·è€…ăšă—ăŠăŠă‚™ăă‚‹ă“ăš
è‡Șćˆ†ăźć­äŸ›ăźă‚Żăƒ©ă‚čă§ć­ŠçŽšćŽ©ćŁŠăŒè”·ă“ăŁăŸæ™‚ă«ă€äżè­·è€…ăšă—ăŠăŠă‚™ăă‚‹ă“ăšYasuhito Morimoto
 
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
 
Red Hat Satellite 6 - Automation with Puppet
Red Hat Satellite 6 - Automation with PuppetRed Hat Satellite 6 - Automation with Puppet
Red Hat Satellite 6 - Automation with PuppetMichael Lessard
 
Lean Production
Lean ProductionLean Production
Lean Productiontutor2u
 
What is big data?
What is big data?What is big data?
What is big data?David Wellman
 
What is Big Data?
What is Big Data?What is Big Data?
What is Big Data?Bernard Marr
 
Big Data - 25 Amazing Facts Everyone Should Know
Big Data - 25 Amazing Facts Everyone Should KnowBig Data - 25 Amazing Facts Everyone Should Know
Big Data - 25 Amazing Facts Everyone Should KnowBernard Marr
 

Andere mochten auch (8)

Designing Puppet: Roles/Profiles Pattern
Designing Puppet: Roles/Profiles PatternDesigning Puppet: Roles/Profiles Pattern
Designing Puppet: Roles/Profiles Pattern
 
è‡Șćˆ†ăźć­äŸ›ăźă‚Żăƒ©ă‚čă§ć­ŠçŽšćŽ©ćŁŠăŒè”·ă“ăŁăŸæ™‚ă«ă€äżè­·è€…ăšă—ăŠăŠă‚™ăă‚‹ă“ăš
è‡Șćˆ†ăźć­äŸ›ăźă‚Żăƒ©ă‚čă§ć­ŠçŽšćŽ©ćŁŠăŒè”·ă“ăŁăŸæ™‚ă«ă€äżè­·è€…ăšă—ăŠăŠă‚™ăă‚‹ă“ăšè‡Șćˆ†ăźć­äŸ›ăźă‚Żăƒ©ă‚čă§ć­ŠçŽšćŽ©ćŁŠăŒè”·ă“ăŁăŸæ™‚ă«ă€äżè­·è€…ăšă—ăŠăŠă‚™ăă‚‹ă“ăš
è‡Șćˆ†ăźć­äŸ›ăźă‚Żăƒ©ă‚čă§ć­ŠçŽšćŽ©ćŁŠăŒè”·ă“ăŁăŸæ™‚ă«ă€äżè­·è€…ăšă—ăŠăŠă‚™ăă‚‹ă“ăš
 
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
 
Red Hat Satellite 6 - Automation with Puppet
Red Hat Satellite 6 - Automation with PuppetRed Hat Satellite 6 - Automation with Puppet
Red Hat Satellite 6 - Automation with Puppet
 
Lean Production
Lean ProductionLean Production
Lean Production
 
What is big data?
What is big data?What is big data?
What is big data?
 
What is Big Data?
What is Big Data?What is Big Data?
What is Big Data?
 
Big Data - 25 Amazing Facts Everyone Should Know
Big Data - 25 Amazing Facts Everyone Should KnowBig Data - 25 Amazing Facts Everyone Should Know
Big Data - 25 Amazing Facts Everyone Should Know
 

Ähnlich wie Puppet Design Patterns

Puppet | Custom Modules & Using the Forge
Puppet | Custom Modules & Using the ForgePuppet | Custom Modules & Using the Forge
Puppet | Custom Modules & Using the ForgeAaron Bernstein
 
modern module development - Ken Barber 2012 Edinburgh Puppet Camp
modern module development - Ken Barber 2012 Edinburgh Puppet Campmodern module development - Ken Barber 2012 Edinburgh Puppet Camp
modern module development - Ken Barber 2012 Edinburgh Puppet CampPuppet
 
Building a Custom Theme in Drupal 8
Building a Custom Theme in Drupal 8Building a Custom Theme in Drupal 8
Building a Custom Theme in Drupal 8Anne Tomasevich
 
Drupal Best Practices
Drupal Best PracticesDrupal Best Practices
Drupal Best PracticesMukesh Agarwal
 
Drupal vs WordPress
Drupal vs WordPressDrupal vs WordPress
Drupal vs WordPressWalter Ebert
 
SynapseIndia drupal presentation on drupal best practices
SynapseIndia drupal  presentation on drupal best practicesSynapseIndia drupal  presentation on drupal best practices
SynapseIndia drupal presentation on drupal best practicesSynapseindiappsdevelopment
 
Learning PHP for Drupal Theming, DC Chicago 2009
Learning PHP for Drupal Theming, DC Chicago 2009Learning PHP for Drupal Theming, DC Chicago 2009
Learning PHP for Drupal Theming, DC Chicago 2009Emma Jane Hogbin Westby
 
Best Practices For Drupal Developers By Mir Nazim @ Drupal Camp India 2008
Best Practices For Drupal Developers By Mir Nazim @ Drupal Camp India 2008Best Practices For Drupal Developers By Mir Nazim @ Drupal Camp India 2008
Best Practices For Drupal Developers By Mir Nazim @ Drupal Camp India 2008Mir Nazim
 
How to? Drupal developer toolkit. Dennis Povshedny.
How to? Drupal developer toolkit. Dennis Povshedny.How to? Drupal developer toolkit. Dennis Povshedny.
How to? Drupal developer toolkit. Dennis Povshedny.DrupalCampDN
 
Managing-Splunk-with-Puppet 31-January-2022.pdf
Managing-Splunk-with-Puppet 31-January-2022.pdfManaging-Splunk-with-Puppet 31-January-2022.pdf
Managing-Splunk-with-Puppet 31-January-2022.pdfssusera181ef
 
Experiences with backend user rights in TYPO3
Experiences with backend user rights in TYPO3Experiences with backend user rights in TYPO3
Experiences with backend user rights in TYPO3punkt.de GmbH
 
Modules of the twenties
Modules of the twentiesModules of the twenties
Modules of the twentiesPuppet
 
Building and Maintaining a Distribution in Drupal 7 with Features
Building and Maintaining a  Distribution in Drupal 7 with FeaturesBuilding and Maintaining a  Distribution in Drupal 7 with Features
Building and Maintaining a Distribution in Drupal 7 with FeaturesNuvole
 
Decoupling Drupal mit dem Lupus Nuxt.js Drupal Stack
Decoupling Drupal mit dem Lupus Nuxt.js Drupal StackDecoupling Drupal mit dem Lupus Nuxt.js Drupal Stack
Decoupling Drupal mit dem Lupus Nuxt.js Drupal Stacknuppla
 
Dependency injection in Drupal 8
Dependency injection in Drupal 8Dependency injection in Drupal 8
Dependency injection in Drupal 8Alexei Gorobets
 
Drupal theming training
Drupal theming trainingDrupal theming training
Drupal theming trainingdropsolid
 

Ähnlich wie Puppet Design Patterns (20)

Puppet | Custom Modules & Using the Forge
Puppet | Custom Modules & Using the ForgePuppet | Custom Modules & Using the Forge
Puppet | Custom Modules & Using the Forge
 
modern module development - Ken Barber 2012 Edinburgh Puppet Camp
modern module development - Ken Barber 2012 Edinburgh Puppet Campmodern module development - Ken Barber 2012 Edinburgh Puppet Camp
modern module development - Ken Barber 2012 Edinburgh Puppet Camp
 
Building a Custom Theme in Drupal 8
Building a Custom Theme in Drupal 8Building a Custom Theme in Drupal 8
Building a Custom Theme in Drupal 8
 
Drupal Best Practices
Drupal Best PracticesDrupal Best Practices
Drupal Best Practices
 
Drupal - Introduction to Drupal Creating Modules
Drupal - Introduction to Drupal Creating ModulesDrupal - Introduction to Drupal Creating Modules
Drupal - Introduction to Drupal Creating Modules
 
Drupal vs WordPress
Drupal vs WordPressDrupal vs WordPress
Drupal vs WordPress
 
Drupal Front End PHP
Drupal Front End PHPDrupal Front End PHP
Drupal Front End PHP
 
SynapseIndia drupal presentation on drupal best practices
SynapseIndia drupal  presentation on drupal best practicesSynapseIndia drupal  presentation on drupal best practices
SynapseIndia drupal presentation on drupal best practices
 
Learning PHP for Drupal Theming, DC Chicago 2009
Learning PHP for Drupal Theming, DC Chicago 2009Learning PHP for Drupal Theming, DC Chicago 2009
Learning PHP for Drupal Theming, DC Chicago 2009
 
Theme Gurus
Theme GurusTheme Gurus
Theme Gurus
 
Best Practices For Drupal Developers By Mir Nazim @ Drupal Camp India 2008
Best Practices For Drupal Developers By Mir Nazim @ Drupal Camp India 2008Best Practices For Drupal Developers By Mir Nazim @ Drupal Camp India 2008
Best Practices For Drupal Developers By Mir Nazim @ Drupal Camp India 2008
 
How to? Drupal developer toolkit. Dennis Povshedny.
How to? Drupal developer toolkit. Dennis Povshedny.How to? Drupal developer toolkit. Dennis Povshedny.
How to? Drupal developer toolkit. Dennis Povshedny.
 
Managing-Splunk-with-Puppet 31-January-2022.pdf
Managing-Splunk-with-Puppet 31-January-2022.pdfManaging-Splunk-with-Puppet 31-January-2022.pdf
Managing-Splunk-with-Puppet 31-January-2022.pdf
 
Experiences with backend user rights in TYPO3
Experiences with backend user rights in TYPO3Experiences with backend user rights in TYPO3
Experiences with backend user rights in TYPO3
 
Modules of the twenties
Modules of the twentiesModules of the twenties
Modules of the twenties
 
Building and Maintaining a Distribution in Drupal 7 with Features
Building and Maintaining a  Distribution in Drupal 7 with FeaturesBuilding and Maintaining a  Distribution in Drupal 7 with Features
Building and Maintaining a Distribution in Drupal 7 with Features
 
Decoupling Drupal mit dem Lupus Nuxt.js Drupal Stack
Decoupling Drupal mit dem Lupus Nuxt.js Drupal StackDecoupling Drupal mit dem Lupus Nuxt.js Drupal Stack
Decoupling Drupal mit dem Lupus Nuxt.js Drupal Stack
 
Drupal development
Drupal development Drupal development
Drupal development
 
Dependency injection in Drupal 8
Dependency injection in Drupal 8Dependency injection in Drupal 8
Dependency injection in Drupal 8
 
Drupal theming training
Drupal theming trainingDrupal theming training
Drupal theming training
 

KĂŒrzlich hochgeladen

Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
call girls in Vaishali (Ghaziabad) 🔝 >àŒ’8448380779 🔝 genuine Escort Service đŸ”âœ”ïžâœ”ïž
call girls in Vaishali (Ghaziabad) 🔝 >àŒ’8448380779 🔝 genuine Escort Service đŸ”âœ”ïžâœ”ïžcall girls in Vaishali (Ghaziabad) 🔝 >àŒ’8448380779 🔝 genuine Escort Service đŸ”âœ”ïžâœ”ïž
call girls in Vaishali (Ghaziabad) 🔝 >àŒ’8448380779 🔝 genuine Escort Service đŸ”âœ”ïžâœ”ïžDelhi Call girls
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
Active Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfActive Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfCionsystems
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto GonzĂĄlez Trastoy
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about usDynamic Netsoft
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
Test Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendTest Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendArshad QA
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
CALL ON ➄8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂
CALL ON ➄8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂CALL ON ➄8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂
CALL ON ➄8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂anilsa9823
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
Clustering techniques data mining book ....
Clustering techniques data mining book ....Clustering techniques data mining book ....
Clustering techniques data mining book ....ShaimaaMohamedGalal
 

KĂŒrzlich hochgeladen (20)

Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
call girls in Vaishali (Ghaziabad) 🔝 >àŒ’8448380779 🔝 genuine Escort Service đŸ”âœ”ïžâœ”ïž
call girls in Vaishali (Ghaziabad) 🔝 >àŒ’8448380779 🔝 genuine Escort Service đŸ”âœ”ïžâœ”ïžcall girls in Vaishali (Ghaziabad) 🔝 >àŒ’8448380779 🔝 genuine Escort Service đŸ”âœ”ïžâœ”ïž
call girls in Vaishali (Ghaziabad) 🔝 >àŒ’8448380779 🔝 genuine Escort Service đŸ”âœ”ïžâœ”ïž
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
Active Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfActive Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdf
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about us
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Test Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendTest Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and Backend
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
CALL ON ➄8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂
CALL ON ➄8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂CALL ON ➄8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂
CALL ON ➄8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂
 
Vip Call Girls Noida âžĄïž Delhi âžĄïž 9999965857 No Advance 24HRS Live
Vip Call Girls Noida âžĄïž Delhi âžĄïž 9999965857 No Advance 24HRS LiveVip Call Girls Noida âžĄïž Delhi âžĄïž 9999965857 No Advance 24HRS Live
Vip Call Girls Noida âžĄïž Delhi âžĄïž 9999965857 No Advance 24HRS Live
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
Call Girls In Mukherjee Nagar đŸ“± 9999965857 đŸ€© Delhi đŸ«Š HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar đŸ“±  9999965857  đŸ€© Delhi đŸ«Š HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar đŸ“±  9999965857  đŸ€© Delhi đŸ«Š HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar đŸ“± 9999965857 đŸ€© Delhi đŸ«Š HOT AND SEXY VVIP 🍎 SE...
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
Clustering techniques data mining book ....
Clustering techniques data mining book ....Clustering techniques data mining book ....
Clustering techniques data mining book ....
 

Puppet Design Patterns

  • 1. PUPPET DESIGN PATTERNS David Danzilio Kovarus, Inc.
  • 2. ➀ Architect with Kovarus ➀ Joined in May 2016 ➀ Previously at Constant Contact, Sandia National Laboratories, and a few other places you’ve never heard of ➀ Operations background, but more of a developer these days ➀ One of the maintainers of Vox Pupuli ➀ Organizer of the Boston Puppet User Group ABOUT ME
  • 3.
  • 5. GANG OF FOUR ➀ Gang of Four (GoF) book introduced the concept for Object Oriented programming ➀ 23 patterns with examples written in C++ and SmallTalk ➀ Published in 1994, more than 500,000 copies sold ➀ One of the best selling software engineering books in history ➀ InïŹ‚uenced an entire generation of developers, languages, and tools
  • 6. DESIGN PATTERNS ➀ Can be highly contextual and language dependent, but a lot can be learned from all of them ➀ The GoF focused on statically-typed, object oriented, compiled languages ➀ Some languages have implemented primitives for these patterns ➀ Not many of the GoF patterns directly apply to Puppet ➀ All of the GoF patterns focus on reinforcing a set of design principles
  • 9. SEPARATE THINGS THAT CHANGE Minimize risk when making changes
  • 10. LOOSE COUPLING Reduce dependencies, increase modularity
  • 11. SEPARATION OF CONCERNS Divide your application into distinct features
  • 13. LEAST KNOWLEDGE Components should know as little as possible about their neighbors
  • 15. PROGRAM TO AN INTERFACE Interfaces are more stable than the implementation
  • 17. SIX PATTERNS ➀ Resource Wrapper: adding functionality to code you don’t own ➀ Package, File, Service: breaking up monolithic classes ➀ Params: delegating parameter defaults ➀ Strategy: doing the same thing diïŹ€erently ➀ Roles and ProïŹles: organizing your code for modularity ➀ Factory: creating resources on the ïŹ‚y
  • 19. ABOUT THE WRAPPER PATTERN ➀ Problem: resources you don’t own are missing some functionality or feature required to implement your requirements ➀ Solution: use composition to add your required functionality without modifying the code you don’t own
  • 20. ABOUT THE WRAPPER PATTERN ➀ Use the resource wrapper pattern when you need to add functionality to an existing resource ➀ When you feel the need to write your own resources, or to make changes to Forge modules, think about whether you should really be using the wrapper pattern ➀ You can do this in Puppet 3 and Puppet 4, but it’s much cleaner in Puppet 4 ➀ This pattern forms the basis of many other patterns you’ll see today
  • 21. EXAMPLE: MANAGING USERS ➀ We want to manage our employee user accounts ➀ Requirements: ➀ The user’s UID should be set to their employee ID ➀ All employees need to be members of the ‘employees’ group ➀ We should manage a user’s bash proïŹle by default, but users may opt out of this upon request
  • 22. EXAMPLE: MANAGING USERS define mycompany::user ( $employee_id, $gid, $groups = ['employees'], $username = $title, $manage_profile = true, ) { if $manage_profile { file { "/home/${username}/.bash_profile": ensure => file, owner => $username, require => User[$username], } } user { $username: uid => $employee_id, gid => $gid, groups => $groups, } } All employees should be in the ‘employees’ group Employee ID is used for the user ID Feature flag to manage your user’s bash profile Manage ~/.bash_profile with a file resource Pass your parameters to the user resource
  • 23. EXAMPLE: MANAGING USERS mycompany::user { 'bob': employee_id => '1093', gid => 'wheel', manage_profile => false, } “We have a new employee named Bob. He’s employee 1093 and he needs to be a member of the wheel group so he can sudo. He wants to manage his own bash profile.”
  • 24. EXAMPLE: MANAGING USERS “Hey, I’d like to have my shell set to /bin/zsh, can you do that for me?” mycompany::user { 'bob': employee_id => '1093', gid => 'wheel', shell => '/bin/zsh', manage_profile => false, } Could not retrieve catalog: Invalid parameter ‘shell’ for type ‘mycompany::user’
  • 25. EXAMPLE: MANAGING USERS define mycompany::user ( $employee_id, $gid, $groups = ['employees'], $username = $title, $manage_profile = true, ) { if $manage_profile { file { "/home/${username}/.bash_profile": ensure => file, owner => $username, require => User[$username], } } user { $username: uid => $employee_id, gid => $gid, groups => $groups, } } Problem You must maintain these parameters.
  • 26. EXAMPLE: MANAGING USERS (PUPPET 3) define mycompany::user ( $username = $title, $manage_profile = true, $user = {} ) { if $manage_profile { file { "/home/${username}/.bash_profile": ensure => file, owner => $username, require => User[$username], } } $user_defaults = { ‘groups’ => [‘employees’] } $user_params = merge($user, $user_defaults) create_resources(‘user’, $username, $user_params) } Much more flexible interface Enforce business rules Create the user resource by passing the hash to create_resources
  • 27. EXAMPLE: MANAGING USERS (PUPPET 4) define mycompany::user ( String $username = $title, Boolean $manage_profile = true, Hash $user = {} ) { if $manage_profile { file { "/home/${username}/.bash_profile": ensure => file, owner => $username, require => User[$username], } } $user_defaults = { 'groups' => [‘employees’] } user { $username: * => $user_defaults + $user, } } Much more flexible interface Enforce business rules Use splat operator to pass hash keys as parameters to the user resource
  • 28. EXAMPLE: MANAGING USERS mycompany::user { 'bob': employee_id => '1093', gid => 'wheel', manage_profile => false, } “Hey, I’d like to have my shell set to /bin/zsh, can you do that for me?” mycompany::user { 'bob': manage_profile => false, user => { 'uid' => '1093', 'gid' => 'wheel', } }
  • 29. EXAMPLE: MANAGING USERS mycompany::user { 'bob': employee_id => '1093', gid => 'wheel', manage_profile => false, } mycompany::user { 'bob': manage_profile => false, user => { 'uid' => '1093', 'gid' => 'wheel', 'shell' => '/bin/zsh', } } “Hey, I’d like to have my shell set to /bin/zsh, can you do that for me?”
  • 31. ABOUT THE PACKAGE/FILE/SERVICE PATTERN ➀ Problem: your module’s init.pp is getting too cluttered because all of your code lives in that one ïŹle ➀ Solution: break out the basic functions of your module into separate classes, generally into a package, config, and service class
  • 32. ABOUT THE PACKAGE/FILE/SERVICE PATTERN ➀ This is one of the ïŹrst patterns you see when learning Puppet ➀ This is the embodiment of the Single Responsibility and Separation of Concerns principles ➀ Most modules can be broken down into some form of Package, ConïŹg File, and Service management ➀ Use this speciïŹc pattern any time you write a module that manages these things ➀ Keep the spirit of this pattern in mind whenever you write a module that is more than a few lines long ➀ This has the added beneïŹt of allowing us to utilize class containment for cleaner resource ordering
  • 33. EXAMPLE: NTP class ntp { case $::osfamily { 'Solaris': { $package_name = ['SUNWntpr', 'SUNWntpu'] $config_file = '/etc/inet/ntp.conf' $service_name = 'network/ntp' } 'RedHat': { $package_name = 'ntp' $config_file = '/etc/ntp.conf' $service_name = 'ntpd' } } package { $package_name: ensure => installed, } file { $config_file: ensure => file, content => template('ntp/ntpd.conf.erb'), require => Package[$package_name], notify => Service[$service_name], } service { $service_name: ensure => running } } Installs the ntp package for that platform Places the ntp config file Ensures that the package is installed first Notifies the ntp service of changes to the file Manages the ntp service Set some variables based on the osfamily fact
  • 34. class ntp { case $osfamily { 'Solaris': { $package_name = ['SUNWntpr', 'SUNWntpu'] $config_file = '/etc/inet/ntp.conf' $service_name = 'network/ntp' } 'RedHat': { $package_name = 'ntp' $config_file = '/etc/ntp.conf' $service_name = 'ntpd' } } class { 'ntp::install': } -> class { 'ntp::config': } ~> class { 'ntp::service': } } EXAMPLE: NTP Installs the ntp package Places the ntp config file Package is installed first Manages the ntp service Notifies the service of changes
  • 35. class ntp::install { package { $ntp::package_name: ensure => installed, } } class ntp::config { file { $ntp::config_file: ensure => file, content => template('ntp/ntpd.conf.erb'), } } class ntp::service { service { $ntp::service_name: ensure => running, } } EXAMPLE: NTP
  • 37. ABOUT THE PARAMS PATTERN ➀ Problem: hard-coded data makes modules fragile, verbose parameter default and variable setting logic make classes hard to read ➀ Solution: convert embedded data to parameters and move that data to a separate class where it can be used as parameter defaults
  • 38. ABOUT THE PARAMS PATTERN ➀ The params pattern breaks out your variable assignment and parameter defaults into a separate class, typically named params ➀ Makes classes easier to read by moving the default setting logic into a purpose-built class ➀ Delegates responsibility for setting defaults to the params class ➀ Module data is a new feature designed to eliminate the params pattern by moving this logic into Hiera ➀ Until module data becomes more ubiquitous, you’ll see params in use in almost every module ➀ Use this pattern any time you have data that must live in your module
  • 39. EXAMPLE: NTP Problems Only supports Solaris and RedHat ~70% of this class is devoted to data class ntp { case $osfamily { 'Solaris': { $package_name = ['SUNWntpr', 'SUNWntpu'] $config_file = '/etc/inet/ntp.conf' $service_name = 'network/ntp' } 'RedHat': { $package_name = 'ntp' $config_file = '/etc/ntp.conf' $service_name = 'ntpd' } } class { 'ntp::install': } -> class { 'ntp::config': } ~> class { 'ntp::service': } }
  • 40. EXAMPLE: NTP class ntp::params { case $::osfamily { 'Solaris': { $package_name = ['SUNWntpr', 'SUNWntpu'] $config_file = '/etc/inet/ntp.conf' $service_name = 'network/ntp' } 'RedHat': { $package_name = 'ntp' $config_file = '/etc/ntp.conf' $service_name = 'ntpd' } } } Create a purpose-built class to store your module’s data These variables become the default values for your class parameters
  • 41. EXAMPLE: NTP class ntp ( $package_name = $ntp::params::package_name, $config_file = $ntp::params::config_file, $service_name = $ntp::params::service_name, ) inherits ntp::params { class { 'ntp::install': } -> class { 'ntp::config': } ~> class { 'ntp::service': } } Inheriting the params class ensures that it is evaluated first Convert the variables to parameters, and set their defaults to the corresponding variables in the params class
  • 43. ABOUT THE STRATEGY PATTERN ➀ Problem: you have multiple ways to achieve basically the same thing in your module, but you need to choose one way based on some criteria (usually a fact) ➀ Solution: break each approach into separate classes and let your caller decide which to include
  • 44. ABOUT THE STRATEGY PATTERN ➀ This is a GoF pattern ➀ Use this pattern when you have lots of logic doing eïŹ€ectively the same thing but with diïŹ€erent details under certain conditions ➀ The Strategy Pattern uses composition to assemble complex behavior from smaller classes
  • 45. EXAMPLE: MYSQL class mysql { ... case $::osfamily { 'Debian': { apt::source { 'mysql': comment => 'MySQL Community APT repository', location => "http://repo.mysql.com/apt/${::operatingsystem}", release => $::lsbdistcodename, repos => 'mysql-5.7', include => { src => false }, } } 'RedHat': { yumrepo { 'mysql': descr => 'MySQL Community YUM repository', baseurl => "http://repo.mysql.com/yum/mysql-5.7-community/el/${::lsbmajdistrelease}/${::architecture}", enabled => true, } } } ... } Both managing a package repository
  • 46. EXAMPLE: MYSQL class mysql::repo::redhat { yumrepo { 'mysql': descr => 'MySQL Community YUM repository', baseurl => "http://repo.mysql.com/yum/mysql-5.7-community/el/${::lsbmajdistrelease}/${::architecture}", enabled => true, } } class mysql::repo::debian { apt::source { 'mysql': comment => 'MySQL Community APT repository', location => "http://repo.mysql.com/apt/${::operatingsystem}", release => $::lsbdistcodename, repos => 'mysql-5.7', include => { src => false }, } } Strategy Classes
  • 47. EXAMPLE: MYSQL class mysql { ... case $::osfamily { 'Debian': { include mysql::repo::debian } 'RedHat': { include mysql::repo::redhat } } ... } Context Class Case statement determines which strategy class to include
  • 48. THE ROLES AND PROFILES PATTERN Organizing your code for modularity
  • 49. ABOUT THE ROLES AND PROFILES PATTERN ➀ Problem: large node statements with many classes, lots of inherited node statements, diïŹƒculty identifying what a server’s purpose is in your environment ➀ Solution: add an extra layer of abstraction between your node and your modules
  • 50. ABOUT THE ROLES AND PROFILES PATTERN ➀ The Roles and ProïŹles pattern was described by Craig Dunn in his blog post Designing Puppet - Roles and ProïŹles ➀ This is one of the most comprehensive design patterns for Puppet ➀ It is the “oïŹƒcial” way to structure your Puppet code ➀ You should always use Roles and ProïŹles ➀ Craig does an excellent job describing these concepts in depth, you should read his blog post here: http://www.craigdunn.org/2012/05/239/
  • 51. WITHOUT ROLES AND PROFILES node base { include mycompany::settings } node www inherits base { include apache include mysql include php include nagios::web_server } node ns1 inherits base { include bind include nagios::bind bind::zone { ‘example.com': type => master } } node ns2 inherits base { include bind include nagios::bind bind::zone { ‘example.com': type => slave } } Base node includes common modules Nodes inherit the base to get common functionality More specific functionality is added in each node statement Problems This file can get really long, really fast Can violate DRY when you have lots of similar nodes Edge cases are hard to manage Node ModulesModules ResourcesResources
  • 52. ROLES AND PROFILES TERMINOLOGY ➀ Module: implements one piece of software or functionality ➀ ProïŹle: combines modules to implement a stack (i.e. “A LAMP stack includes the apache, mysql, and php modules”) ➀ Role: combine proïŹles to implement your business rules (i.e. “This server is a web server”) ➀ A node can only ever include one role ➀ If you think you need to include two roles, you’ve probably just identiïŹed another role Node ModulesModules ResourcesResourcesRole ModulesProfiles
  • 53. CONVERTING TO ROLES AND PROFILES class roles::base { include profiles::base } class roles::web_server { include profiles::base include profiles::lamp } class roles::nameserver::master inherits roles::base { include profiles::bind::master } class roles::nameserver::slave inherits roles::base { include profiles::bind::slave } class profiles::base { include mycompany::settings } class profiles::lamp { include apache include mysql include php include nagios::web_server } class profiles::bind ($type = master) { include bind bind::zone { 'example.com': type => $type, } } class profiles::bind::master { include profiles::bind } class profiles::bind::slave { class { 'profiles::bind': type => slave, } }
  • 54. CONVERTING TO ROLES AND PROFILES node www { include roles::web_server } node ns1 { include roles::nameserver::master } node ns2 { include roles::nameserver::slave } node base { include mycompany::settings } node www inherits base { include apache include mysql include php include nagios::web_server } node ns1 inherits base { include bind include nagios::bind bind::zone { ‘example.com': type => master } } node ns2 inherits base { include bind include nagios::bind bind::zone { ‘example.com': type => slave } }
  • 56. ABOUT THE FACTORY PATTERN ➀ Problem: your module has to create a lot of resources of the same type, or you want to control how resources are created with your module ➀ Solution: create the resources in your class based on data passed to your parameters
  • 57. ABOUT THE FACTORY PATTERN ➀ This is also known as the create_resources pattern ➀ Emerged early on as crude iteration support in older Puppet versions ➀ We already saw this in action in the Resource Wrapper Pattern example ➀ Use this pattern when you want your module to have a single entry point, even for creating your own resources
  • 58. EXAMPLE: MANAGING CONFIGURATION WITH INI_SETTING class puppet ( $ca_server = 'puppet-ca.example.com', $master = 'puppet.example.com', $pluginsync = true, $noop = false, ) { $defaults = { 'path' => '/etc/puppet/puppet.conf' } $main_section = { 'main/ca_server' => { 'setting' => 'ca_server', 'value' => $ca_server }, 'main/server' => { 'setting' => 'server', 'value' => $master }, } $agent_section = { 'agent/pluginsync' => { 'setting' => 'pluginsync', 'value' => $pluginsync }, 'agent/noop' => { 'setting' => 'noop', 'value' => $noop }, } create_resources('ini_setting', $main_section, merge($defaults, { section => 'main' })) create_resources('ini_setting', $agent_section, merge($defaults, { section => 'agent' })) } Get data from params Organize the data so we can consume it with create_resources Pass the munged data to create_resources
  • 59. EXAMPLE: MANAGING CONFIGURATION WITH INI_SETTING (PUPPET 4) class puppet ( String $path = '/etc/puppet/puppet.conf', Hash $main_section = { 'ca_server' => 'puppet-ca.example.com', 'server' => 'puppet.example.com' }, Hash $agent_section = { 'pluginsync' => true, 'noop' => false, }, ) { ['agent', 'main'].each |$section| { $data = getvar("${section}_section") $data.each |$key,$val| { ini_setting { "${section}/${key}": path => $path, section => $section, setting => $key, value => $val, } } } } Pass a hash for each section Iterate over each section name Fetch the variable that holds that section’s data Iterate over that data, passing it to an ini_setting resource
  • 61. STAY TUNED FOR MORE PATTERNS
  • 62. CONTACT INFO ➀ @djdanzilio on Twitter ➀ danzilio on Freenode (you can usually ïŹnd me in #voxpupuli, #puppet-dev, and #puppet) ➀ danzilio on GitHub and The Forge ➀ ddanzilio (at) kovarus (dot) com ➀ blog.danzil.io ➀ www.kovarus.com