SlideShare a Scribd company logo
1 of 77
Download to read offline
2014 
Presented by 
The Refactor Dance 
Gary Larizza 
Professional Services | Puppet Labs 
@glarizza
http://bit.ly/refactordance 
Presented by
Presented by
Worst. Hands-on. Ever 
Presented by
Presented by 
• Abstraction and data separation 
• Data Hierarchy 
• Classification 
• Workflow
Presented by 
Classification 
Implementation Implementation
Presented by 
Role 
Hiera 
Profile Profile 
Component 
Modules
Presented by 
roles::application_server 
Hiera 
profiles::java profiles::tomcat 
Component 
Modules
Component 
Modules 
Presented by
Stop writing custom 
goddamn component 
Presented by 
modules
Presented by 
$httpd_root = "/opt/corp/data/http" 
package 
{ 
‘httpd’: 
ensure => latest, 
} 
file { 
“/opt/corp/data/http/conf.d”: 
owner => "httpd", 
ensure => directory; 
“/opt/corp/data/http/conf.d/corp.conf”: 
owner => "httpd", 
ensure => file; 
}
Stop writing component modules 
Presented by 
• Too many ‘okay’ modules 
• Maintenance & upkeep 
• You are not unique 
• You are entirely too lazy
Parameterize 
your classes 
Presented by
Presented by 
class apache {! 
case $::osfamily {! 
'RedHat': {! 
$confdir = ‘/etc/httpd/conf‘! 
$conffile = “${confdir}/httpd.conf”! 
}! 
'Debian': {! 
$confdir = ‘/etc/apache2/conf‘! 
$conffile = “${confdir}/apache2.conf”! 
}! 
}! 
}
Presented by 
class apache (! 
$confdir = $apache::params::confdir,! 
$conffile = $apache::params::conffile,! 
) inherits apache::params {! 
file { $confdir:! 
ensure => directory,! 
}! 
file { $conffile:! 
ensure => file,! 
content => template(’apache/apache.conf.erb’),! 
}! 
}
Presented by 
Parameterize classes 
• Parameters = API 
• Single-entry classes 
• The ‘Forge test’
Params & 
shareable data 
Presented by
Presented by 
class apache::params {! 
case $::osfamily {! 
'RedHat': {! 
$confdir = ‘/etc/httpd/conf‘! 
$conffile = “${confdir}/httpd.conf”! 
}! 
'Debian': {! 
$confdir = ‘/etc/apache2/conf‘! 
$conffile = “${confdir}/apache2.conf”! 
}! 
}! 
}
Presented by 
Shareable data 
• OS-specific data != private data 
• Sane defaults 
• Validation…
Presented by 
Validation
Presented by 
class xinetd (! 
$confdir = $apache::params::confdir,! 
$conffile = $apache::params::conffile,! 
) inherits xinetd::params {! 
file { $confdir:! 
ensure => directory,! 
}! 
file { $conffile:! 
ensure => file,! 
content => template(’apache/apache.conf.erb’),! 
}! 
}
Presented by 
class xinetd (! 
$confdir = $apache::params::confdir,! 
$conffile = $apache::params::conffile,! 
) inherits xinetd::params {! 
validate_absolute_path($confdir)! 
validate_absolute_path($conffile)! 
file { $confdir:! 
ensure => directory,! 
}! 
file { $conffile:! 
ensure => file,! 
content => template(’apache/apache.conf.erb’),! 
}! 
}
Presented by 
Validation 
• Functions in puppetlabs-stdlib 
• Never pass unvalidated data to resources
Presented by 
Class
Presented by 
class mysql::server (! 
## params here! 
) inherits mysql::params {! 
! 
include ::mysql::server::install! 
include ::mysql::server::config! 
include ::mysql::server::service! 
! 
}
Presented by 
class mysql::server (! 
## params here! 
) inherits mysql::params {! 
! 
include ::mysql::server::install! 
include ::mysql::server::config! 
include ::mysql::server::service! 
! 
anchor { ‘mysql:start’: }! 
-> Class[‘mysql::server::install’]! 
-> Class[‘mysql::server::config’]! 
-> Class[‘mysql::server::service’]! 
-> anchor { ‘mysql:end’: }! 
}
Presented by 
class mysql::server (! 
## params here! 
) inherits mysql::params {! 
! 
contain ::mysql::server::install! 
contain ::mysql::server::config! 
contain ::mysql::server::service! 
! 
} 
* Puppet ≥ 3.4.0
Presented by 
Class containment 
• Before Puppet 3.4.0 - use anchors 
• After Puppet 3.4.0 - use contain
Presented by 
Hiera
Presented by 
class data_in_code {! 
case $::application_tier {! 
'dev': {! 
$java_version = '6.0.3'! 
$tomcat_version = '6.0'! 
}! 
! 
'test': {! 
$java_version = '7.0.1'! 
$tomcat_version = '7.0'! 
}! 
}! 
}
class data_in_code {! 
$java_version = hiera(’java_version’)! 
$tomcat_version = hiera(’tomcat_version’)! 
} 
Presented by
Presented by 
hiera.yaml 
--- 
:backends: 
- yaml 
:yaml: 
:datadir: /etc/puppetlabs/puppet/hieradata 
:hierarchy: 
- “nodes/%{::clientcert}” 
- “location/%{::location}" 
- “tier/%{::application_tier}" 
- common
Presented by 
--- 
java_version: 7.0 
tomcat_version: 8.0 
dev.yaml 
--- 
java_version: 6.0 
tomcat_version: 7.0 
prod.yaml
Presented by 
Where’s
Presented by 
What’s an 
Application
‘Application tier’ 
• Long lived 
• Data usually separate 
• ‘The Data’ 
Presented by 
! 
! 
! 
‘Environment’ 
• Short lived 
• Migration path to ‘production’ 
• ‘The Model’ 
! 
! 
!
Presented by 
Hierarchy structure? 
• How/where is data different? 
• Most -> least specific 
• Folders are your friends
Profiles 
Presented by
Presented by 
But first…
Presented by 
include apache! 
vs.! 
class { ‘apache’: }!
Presented by 
include apache! 
include apache! 
include apache! 
include apache! 
include apache!
Presented by 
class { ‘apache’: }! 
include apache!
Presented by 
include apache! 
class { ‘apache’: }! 
include apache!
Namespacing 
Presented by
class data_in_code {! 
$java_version = hiera(’java_version’)! 
$tomcat_version = hiera(’tomcat_version’)! 
! 
notify { “Java is: ${java_version}”: }! 
} 
Presented by
Presented by 
class data_in_code {! 
$java_version = hiera(’java_version’)! 
$tomcat_version = hiera(’tomcat_version’)! 
! 
notify { “Java is: ${data_in_code::java_version}”: }! 
}
class profiles::jenkins {! 
include jenkins! 
} 
Presented by
class profiles::jenkins {! 
include ???????! 
} 
Presented by
class profiles::jenkins {! 
include ::jenkins! 
} 
Presented by
Presented by 
Data
Presented by 
class data_in_code {! 
case $::application_tier {! 
'dev': {! 
$java_version = '6.0.3'! 
$tomcat_version = '6.0'! 
}! 
! 
'test': {! 
$java_version = '7.0.1'! 
$tomcat_version = '7.0'! 
}! 
}! 
}
Presented by 
class profiles::tomcat {! 
$java_version = hiera(’java_version’)! 
$tomcat_version = hiera(’tomcat_version’)! 
! 
class { ’::tomcat’:! 
version => $tomcat_version,! 
}! 
! 
class { ’::java’:! 
version => $java_version,! 
}! 
}
Presented by 
class apache {! 
file { ‘/opt/custom/key.pem’:! 
ensure => file,! 
source => ’puppet:///modules/apache/key.pem'! 
}! 
! 
file { ‘/things/that/dont/belong/in/apache’:! 
ensure => file,! 
source => ’puppet:///modules/apache/blargh'! 
} ! 
}
Presented by 
class profiles::apache {! 
include apache! 
$keypath = hiera(’apache_keypath’)! 
! 
file { “${keypath}/key.pem”:! 
ensure => file,! 
source => ’puppet:///modules/profiles/key.pem'! 
}! 
! 
file { ‘/things/that/dont/belong/in/apache’:! 
ensure => file,! 
source => ’puppet:///modules/profiles/blargh'! 
}! 
}
Dependencies 
Presented by
Presented by 
class tomcat {! 
class { ‘java’:! 
version => ‘6.0’,! 
}! 
! 
Class[‘java’]! 
-> Class[‘tomcat’]! 
}
Presented by 
class profiles::tomcat {! 
$java_version = hiera(’java_version’)! 
$tomcat_version = hiera(’tomcat_version’)! 
! 
class { ‘::java’:! 
version => $java_version,! 
}! 
class { ‘::tomcat’:! 
version => $tomcat_version,! 
}! 
! 
Class[‘::java’]! 
-> Class[‘::tomcat’]! 
}
class profiles::tomcat {! 
include profiles::java! 
$tomcat_version = hiera(’tomcat_version’)! 
! 
class { ‘::tomcat’:! 
Presented by 
version => $tomcat_version,! 
}! 
! 
Class[‘profiles::java’]! 
-> Class[‘::tomcat’]! 
}
Presented by 
Profiles 
• Hiera for business-specific data 
• Proprietary resources 
• Inter-class dependencies and containment
Roles 
Presented by
Classification 
Presented by
Presented by 
denuatapp06p 
falcor
roles::app_server::pci 
Presented by 
roles::proxy
class roles {! 
include profiles::security::base! 
include profiles::mycorp::users! 
include profiles::mycorp::os_base! 
} 
Presented by
class roles::app_server inherits roles {! 
include profiles::tomcat! 
include profiles::our_app! 
include profiles::shibboleth! 
Presented by 
! 
Class[‘profiles::tomcat’]! 
-> Class[‘profiles::our_app’]! 
-> Class[‘profiles::shibboleth’]! 
}
class roles::app_server::pci inherits 
roles::app_server {! 
include profiles::pci! 
} 
Presented by
Presented by 
class roles::app_server::pci {! 
include profiles::security::base! 
include profiles::mycorp::users! 
include profiles::mycorp::os_base! 
include profiles::pci! 
include profiles::tomcat! 
include profiles::our_app! 
include profiles::shibboleth! 
include profiles::pci! 
! 
Class[‘profiles::java’]! 
-> Class[‘profiles::our_app’]! 
-> Class[‘profiles::shibboleth’]! 
}
Presented by 
Roles 
• Hostnames minus Hiera 
• Technology-independent 
• Inheritance makes sense (or not)
Workflow 
Presented by
Presented by 
Module
forge "http://forge.puppetlabs.com"! 
! 
# Modules from the Puppet Forge! 
mod "puppetlabs/apache"! 
mod "puppetlabs/ntp"! 
! 
# Modules from Github using various references! 
mod 'notifyme',! 
:git => 'git://github.com/glarizza/puppet-notifyme',! 
:ref => '50c01703b2e3e352520a9a2271ea4947fe17a51f'! 
! 
mod 'profiles',! 
:git => 'git://github.com/glarizza/puppet-profiles',! 
:ref => '3611ae4253ff01762f9bda1d93620edf8f9a3b22' 
Presented by
R10k - Bad name, good robot 
1. Ensuring modules based on a Puppetfile 
2. Dynamically creating Puppet environments 
Presented by
Presented by 
Puppetfile 
Manifest 
Hieradata 
Control Repository
Presented by 
Puppetfile 
Manifest 
Hieradata 
Puppetfile 
Manifest 
Hieradata 
Puppetfile 
Manifest 
Hieradata
Presented by 
Puppetfile 
Manifest 
Hieradata 
Branch Branch 
Puppetfile 
Manifest 
Hieradata 
Puppetfile 
Manifest 
Hieradata 
Puppet Environment Puppet Environment
Presented by 
Demo
Presented by 
Summary 
• Simple, generic component modules 
• Extract company-specific data with Hiera 
• Layer implementation with Profiles 
• Classification with Profiles

More Related Content

What's hot

SPL to the Rescue - Tek 09
SPL to the Rescue - Tek 09SPL to the Rescue - Tek 09
SPL to the Rescue - Tek 09Elizabeth Smith
 
Puppet Camp Berlin 2015: Martin Alfke | The Power of Puppet 4
Puppet Camp Berlin 2015: Martin Alfke | The Power of Puppet 4Puppet Camp Berlin 2015: Martin Alfke | The Power of Puppet 4
Puppet Camp Berlin 2015: Martin Alfke | The Power of Puppet 4NETWAYS
 
Doing It Wrong with Puppet -
Doing It Wrong with Puppet - Doing It Wrong with Puppet -
Doing It Wrong with Puppet - Puppet
 
Replacing "exec" with a type and provider: Return manifests to a declarative ...
Replacing "exec" with a type and provider: Return manifests to a declarative ...Replacing "exec" with a type and provider: Return manifests to a declarative ...
Replacing "exec" with a type and provider: Return manifests to a declarative ...Puppet
 
Can you upgrade to Puppet 4.x? (Beginner) Can you upgrade to Puppet 4.x? (Beg...
Can you upgrade to Puppet 4.x? (Beginner) Can you upgrade to Puppet 4.x? (Beg...Can you upgrade to Puppet 4.x? (Beginner) Can you upgrade to Puppet 4.x? (Beg...
Can you upgrade to Puppet 4.x? (Beginner) Can you upgrade to Puppet 4.x? (Beg...Puppet
 
Puppet at Bazaarvoice
Puppet at BazaarvoicePuppet at Bazaarvoice
Puppet at BazaarvoicePuppet
 
Advanced symfony Techniques
Advanced symfony TechniquesAdvanced symfony Techniques
Advanced symfony TechniquesKris Wallsmith
 
Php on the desktop and php gtk2
Php on the desktop and php gtk2Php on the desktop and php gtk2
Php on the desktop and php gtk2Elizabeth Smith
 
Puppet camp chicago-automated_testing2
Puppet camp chicago-automated_testing2Puppet camp chicago-automated_testing2
Puppet camp chicago-automated_testing2nottings
 
Puppet Camp Portland 2015: Introduction to Hiera (Beginner)
Puppet Camp Portland 2015: Introduction to Hiera (Beginner)Puppet Camp Portland 2015: Introduction to Hiera (Beginner)
Puppet Camp Portland 2015: Introduction to Hiera (Beginner)Puppet
 
Migrating to Puppet 4.0
Migrating to Puppet 4.0Migrating to Puppet 4.0
Migrating to Puppet 4.0Puppet
 
Php on the Web and Desktop
Php on the Web and DesktopPhp on the Web and Desktop
Php on the Web and DesktopElizabeth Smith
 
The worst Ruby codes I’ve seen in my life - RubyKaigi 2015
The worst Ruby codes I’ve seen in my life - RubyKaigi 2015The worst Ruby codes I’ve seen in my life - RubyKaigi 2015
The worst Ruby codes I’ve seen in my life - RubyKaigi 2015Fernando Hamasaki de Amorim
 
Writing and using php streams and sockets tek11
Writing and using php streams and sockets   tek11Writing and using php streams and sockets   tek11
Writing and using php streams and sockets tek11Elizabeth Smith
 
Puppet for Sys Admins
Puppet for Sys AdminsPuppet for Sys Admins
Puppet for Sys AdminsPuppet
 
Object Trampoline: Why having not the object you want is what you need.
Object Trampoline: Why having not the object you want is what you need.Object Trampoline: Why having not the object you want is what you need.
Object Trampoline: Why having not the object you want is what you need.Workhorse Computing
 
Scaling Symfony2 apps with RabbitMQ - Symfony UK Meetup
Scaling Symfony2 apps with RabbitMQ - Symfony UK MeetupScaling Symfony2 apps with RabbitMQ - Symfony UK Meetup
Scaling Symfony2 apps with RabbitMQ - Symfony UK MeetupKacper Gunia
 
PHP 8.1 - What's new and changed
PHP 8.1 - What's new and changedPHP 8.1 - What's new and changed
PHP 8.1 - What's new and changedAyesh Karunaratne
 

What's hot (20)

SPL to the Rescue - Tek 09
SPL to the Rescue - Tek 09SPL to the Rescue - Tek 09
SPL to the Rescue - Tek 09
 
Puppet Camp Berlin 2015: Martin Alfke | The Power of Puppet 4
Puppet Camp Berlin 2015: Martin Alfke | The Power of Puppet 4Puppet Camp Berlin 2015: Martin Alfke | The Power of Puppet 4
Puppet Camp Berlin 2015: Martin Alfke | The Power of Puppet 4
 
Doing It Wrong with Puppet -
Doing It Wrong with Puppet - Doing It Wrong with Puppet -
Doing It Wrong with Puppet -
 
Spl in the wild
Spl in the wildSpl in the wild
Spl in the wild
 
Replacing "exec" with a type and provider: Return manifests to a declarative ...
Replacing "exec" with a type and provider: Return manifests to a declarative ...Replacing "exec" with a type and provider: Return manifests to a declarative ...
Replacing "exec" with a type and provider: Return manifests to a declarative ...
 
Can you upgrade to Puppet 4.x? (Beginner) Can you upgrade to Puppet 4.x? (Beg...
Can you upgrade to Puppet 4.x? (Beginner) Can you upgrade to Puppet 4.x? (Beg...Can you upgrade to Puppet 4.x? (Beginner) Can you upgrade to Puppet 4.x? (Beg...
Can you upgrade to Puppet 4.x? (Beginner) Can you upgrade to Puppet 4.x? (Beg...
 
Puppet at Bazaarvoice
Puppet at BazaarvoicePuppet at Bazaarvoice
Puppet at Bazaarvoice
 
Advanced symfony Techniques
Advanced symfony TechniquesAdvanced symfony Techniques
Advanced symfony Techniques
 
Introduction to Perl and BioPerl
Introduction to Perl and BioPerlIntroduction to Perl and BioPerl
Introduction to Perl and BioPerl
 
Php on the desktop and php gtk2
Php on the desktop and php gtk2Php on the desktop and php gtk2
Php on the desktop and php gtk2
 
Puppet camp chicago-automated_testing2
Puppet camp chicago-automated_testing2Puppet camp chicago-automated_testing2
Puppet camp chicago-automated_testing2
 
Puppet Camp Portland 2015: Introduction to Hiera (Beginner)
Puppet Camp Portland 2015: Introduction to Hiera (Beginner)Puppet Camp Portland 2015: Introduction to Hiera (Beginner)
Puppet Camp Portland 2015: Introduction to Hiera (Beginner)
 
Migrating to Puppet 4.0
Migrating to Puppet 4.0Migrating to Puppet 4.0
Migrating to Puppet 4.0
 
Php on the Web and Desktop
Php on the Web and DesktopPhp on the Web and Desktop
Php on the Web and Desktop
 
The worst Ruby codes I’ve seen in my life - RubyKaigi 2015
The worst Ruby codes I’ve seen in my life - RubyKaigi 2015The worst Ruby codes I’ve seen in my life - RubyKaigi 2015
The worst Ruby codes I’ve seen in my life - RubyKaigi 2015
 
Writing and using php streams and sockets tek11
Writing and using php streams and sockets   tek11Writing and using php streams and sockets   tek11
Writing and using php streams and sockets tek11
 
Puppet for Sys Admins
Puppet for Sys AdminsPuppet for Sys Admins
Puppet for Sys Admins
 
Object Trampoline: Why having not the object you want is what you need.
Object Trampoline: Why having not the object you want is what you need.Object Trampoline: Why having not the object you want is what you need.
Object Trampoline: Why having not the object you want is what you need.
 
Scaling Symfony2 apps with RabbitMQ - Symfony UK Meetup
Scaling Symfony2 apps with RabbitMQ - Symfony UK MeetupScaling Symfony2 apps with RabbitMQ - Symfony UK Meetup
Scaling Symfony2 apps with RabbitMQ - Symfony UK Meetup
 
PHP 8.1 - What's new and changed
PHP 8.1 - What's new and changedPHP 8.1 - What's new and changed
PHP 8.1 - What's new and changed
 

Viewers also liked

Designing Puppet: Roles/Profiles Pattern
Designing Puppet: Roles/Profiles PatternDesigning Puppet: Roles/Profiles Pattern
Designing Puppet: Roles/Profiles PatternPuppet
 
Configuration management with puppet
Configuration management with puppetConfiguration management with puppet
Configuration management with puppetJakub Stransky
 
Love / Hate Puppet (Puppet Gotchas)
Love / Hate Puppet (Puppet Gotchas)Love / Hate Puppet (Puppet Gotchas)
Love / Hate Puppet (Puppet Gotchas)Puppet
 
Keynote Puppet Camp San Francisco 2010
Keynote Puppet Camp San Francisco 2010Keynote Puppet Camp San Francisco 2010
Keynote Puppet Camp San Francisco 2010Puppet
 
Deliver on DevOps with Puppet Application Orchestration Webinar 11/19/15
Deliver on DevOps with Puppet Application Orchestration Webinar 11/19/15Deliver on DevOps with Puppet Application Orchestration Webinar 11/19/15
Deliver on DevOps with Puppet Application Orchestration Webinar 11/19/15Puppet
 

Viewers also liked (6)

Designing Puppet: Roles/Profiles Pattern
Designing Puppet: Roles/Profiles PatternDesigning Puppet: Roles/Profiles Pattern
Designing Puppet: Roles/Profiles Pattern
 
Puppet
PuppetPuppet
Puppet
 
Configuration management with puppet
Configuration management with puppetConfiguration management with puppet
Configuration management with puppet
 
Love / Hate Puppet (Puppet Gotchas)
Love / Hate Puppet (Puppet Gotchas)Love / Hate Puppet (Puppet Gotchas)
Love / Hate Puppet (Puppet Gotchas)
 
Keynote Puppet Camp San Francisco 2010
Keynote Puppet Camp San Francisco 2010Keynote Puppet Camp San Francisco 2010
Keynote Puppet Camp San Francisco 2010
 
Deliver on DevOps with Puppet Application Orchestration Webinar 11/19/15
Deliver on DevOps with Puppet Application Orchestration Webinar 11/19/15Deliver on DevOps with Puppet Application Orchestration Webinar 11/19/15
Deliver on DevOps with Puppet Application Orchestration Webinar 11/19/15
 

Similar to Doing the Refactor Dance - Making Your Puppet Modules More Modular - PuppetConf 2014

Does your configuration code smell?
Does your configuration code smell?Does your configuration code smell?
Does your configuration code smell?Tushar Sharma
 
Rails 3 overview
Rails 3 overviewRails 3 overview
Rails 3 overviewYehuda Katz
 
Rails 3: Dashing to the Finish
Rails 3: Dashing to the FinishRails 3: Dashing to the Finish
Rails 3: Dashing to the FinishYehuda Katz
 
Intro to Rails
Intro to Rails Intro to Rails
Intro to Rails epiineg1
 
Oliver hookins puppetcamp2011
Oliver hookins puppetcamp2011Oliver hookins puppetcamp2011
Oliver hookins puppetcamp2011Puppet
 
All I Need to Know I Learned by Writing My Own Web Framework
All I Need to Know I Learned by Writing My Own Web FrameworkAll I Need to Know I Learned by Writing My Own Web Framework
All I Need to Know I Learned by Writing My Own Web FrameworkBen Scofield
 
Puppet Camp Chicago 2014: Smoothing Troubles With Custom Types and Providers ...
Puppet Camp Chicago 2014: Smoothing Troubles With Custom Types and Providers ...Puppet Camp Chicago 2014: Smoothing Troubles With Custom Types and Providers ...
Puppet Camp Chicago 2014: Smoothing Troubles With Custom Types and Providers ...Puppet
 
Puppet atbazaarvoice
Puppet atbazaarvoicePuppet atbazaarvoice
Puppet atbazaarvoiceDave Barcelo
 
BP-6 Repository Customization Best Practices
BP-6 Repository Customization Best PracticesBP-6 Repository Customization Best Practices
BP-6 Repository Customization Best PracticesAlfresco Software
 
Puppet Camp LA 2015: Basic Puppet Module Design (Beginner)
Puppet Camp LA  2015: Basic Puppet Module Design (Beginner)Puppet Camp LA  2015: Basic Puppet Module Design (Beginner)
Puppet Camp LA 2015: Basic Puppet Module Design (Beginner)Puppet
 
Puppetcamp module design talk
Puppetcamp module design talkPuppetcamp module design talk
Puppetcamp module design talkJeremy Kitchen
 
Quality Assurance for PHP projects - ZendCon 2012
Quality Assurance for PHP projects - ZendCon 2012Quality Assurance for PHP projects - ZendCon 2012
Quality Assurance for PHP projects - ZendCon 2012Michelangelo van Dam
 
Using and scaling Rack and Rack-based middleware
Using and scaling Rack and Rack-based middlewareUsing and scaling Rack and Rack-based middleware
Using and scaling Rack and Rack-based middlewareAlona Mekhovova
 
What's New In Laravel 5
What's New In Laravel 5What's New In Laravel 5
What's New In Laravel 5Darren Craig
 
関西PHP勉強会 php5.4つまみぐい
関西PHP勉強会 php5.4つまみぐい関西PHP勉強会 php5.4つまみぐい
関西PHP勉強会 php5.4つまみぐいHisateru Tanaka
 
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
 
Custom deployments with sbt-native-packager
Custom deployments with sbt-native-packagerCustom deployments with sbt-native-packager
Custom deployments with sbt-native-packagerGaryCoady
 

Similar to Doing the Refactor Dance - Making Your Puppet Modules More Modular - PuppetConf 2014 (20)

Does your configuration code smell?
Does your configuration code smell?Does your configuration code smell?
Does your configuration code smell?
 
Rails 3 overview
Rails 3 overviewRails 3 overview
Rails 3 overview
 
Rails 3: Dashing to the Finish
Rails 3: Dashing to the FinishRails 3: Dashing to the Finish
Rails 3: Dashing to the Finish
 
Intro to Rails
Intro to Rails Intro to Rails
Intro to Rails
 
Oliver hookins puppetcamp2011
Oliver hookins puppetcamp2011Oliver hookins puppetcamp2011
Oliver hookins puppetcamp2011
 
All I Need to Know I Learned by Writing My Own Web Framework
All I Need to Know I Learned by Writing My Own Web FrameworkAll I Need to Know I Learned by Writing My Own Web Framework
All I Need to Know I Learned by Writing My Own Web Framework
 
Having Fun with Play
Having Fun with PlayHaving Fun with Play
Having Fun with Play
 
Play vs Rails
Play vs RailsPlay vs Rails
Play vs Rails
 
Puppet Camp Chicago 2014: Smoothing Troubles With Custom Types and Providers ...
Puppet Camp Chicago 2014: Smoothing Troubles With Custom Types and Providers ...Puppet Camp Chicago 2014: Smoothing Troubles With Custom Types and Providers ...
Puppet Camp Chicago 2014: Smoothing Troubles With Custom Types and Providers ...
 
Puppet atbazaarvoice
Puppet atbazaarvoicePuppet atbazaarvoice
Puppet atbazaarvoice
 
What's new in Django 1.2?
What's new in Django 1.2?What's new in Django 1.2?
What's new in Django 1.2?
 
BP-6 Repository Customization Best Practices
BP-6 Repository Customization Best PracticesBP-6 Repository Customization Best Practices
BP-6 Repository Customization Best Practices
 
Puppet Camp LA 2015: Basic Puppet Module Design (Beginner)
Puppet Camp LA  2015: Basic Puppet Module Design (Beginner)Puppet Camp LA  2015: Basic Puppet Module Design (Beginner)
Puppet Camp LA 2015: Basic Puppet Module Design (Beginner)
 
Puppetcamp module design talk
Puppetcamp module design talkPuppetcamp module design talk
Puppetcamp module design talk
 
Quality Assurance for PHP projects - ZendCon 2012
Quality Assurance for PHP projects - ZendCon 2012Quality Assurance for PHP projects - ZendCon 2012
Quality Assurance for PHP projects - ZendCon 2012
 
Using and scaling Rack and Rack-based middleware
Using and scaling Rack and Rack-based middlewareUsing and scaling Rack and Rack-based middleware
Using and scaling Rack and Rack-based middleware
 
What's New In Laravel 5
What's New In Laravel 5What's New In Laravel 5
What's New In Laravel 5
 
関西PHP勉強会 php5.4つまみぐい
関西PHP勉強会 php5.4つまみぐい関西PHP勉強会 php5.4つまみぐい
関西PHP勉強会 php5.4つまみぐい
 
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
 
Custom deployments with sbt-native-packager
Custom deployments with sbt-native-packagerCustom deployments with sbt-native-packager
Custom deployments with sbt-native-packager
 

More from 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
 

More from 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
 

Recently uploaded

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
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
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
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
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
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
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
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
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
 

Recently uploaded (20)

Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
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
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
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
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
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
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 

Doing the Refactor Dance - Making Your Puppet Modules More Modular - PuppetConf 2014

  • 1. 2014 Presented by The Refactor Dance Gary Larizza Professional Services | Puppet Labs @glarizza
  • 4. Worst. Hands-on. Ever Presented by
  • 5. Presented by • Abstraction and data separation • Data Hierarchy • Classification • Workflow
  • 6. Presented by Classification Implementation Implementation
  • 7. Presented by Role Hiera Profile Profile Component Modules
  • 8. Presented by roles::application_server Hiera profiles::java profiles::tomcat Component Modules
  • 10. Stop writing custom goddamn component Presented by modules
  • 11. Presented by $httpd_root = "/opt/corp/data/http" package { ‘httpd’: ensure => latest, } file { “/opt/corp/data/http/conf.d”: owner => "httpd", ensure => directory; “/opt/corp/data/http/conf.d/corp.conf”: owner => "httpd", ensure => file; }
  • 12. Stop writing component modules Presented by • Too many ‘okay’ modules • Maintenance & upkeep • You are not unique • You are entirely too lazy
  • 14. Presented by class apache {! case $::osfamily {! 'RedHat': {! $confdir = ‘/etc/httpd/conf‘! $conffile = “${confdir}/httpd.conf”! }! 'Debian': {! $confdir = ‘/etc/apache2/conf‘! $conffile = “${confdir}/apache2.conf”! }! }! }
  • 15. Presented by class apache (! $confdir = $apache::params::confdir,! $conffile = $apache::params::conffile,! ) inherits apache::params {! file { $confdir:! ensure => directory,! }! file { $conffile:! ensure => file,! content => template(’apache/apache.conf.erb’),! }! }
  • 16. Presented by Parameterize classes • Parameters = API • Single-entry classes • The ‘Forge test’
  • 17. Params & shareable data Presented by
  • 18. Presented by class apache::params {! case $::osfamily {! 'RedHat': {! $confdir = ‘/etc/httpd/conf‘! $conffile = “${confdir}/httpd.conf”! }! 'Debian': {! $confdir = ‘/etc/apache2/conf‘! $conffile = “${confdir}/apache2.conf”! }! }! }
  • 19. Presented by Shareable data • OS-specific data != private data • Sane defaults • Validation…
  • 21. Presented by class xinetd (! $confdir = $apache::params::confdir,! $conffile = $apache::params::conffile,! ) inherits xinetd::params {! file { $confdir:! ensure => directory,! }! file { $conffile:! ensure => file,! content => template(’apache/apache.conf.erb’),! }! }
  • 22. Presented by class xinetd (! $confdir = $apache::params::confdir,! $conffile = $apache::params::conffile,! ) inherits xinetd::params {! validate_absolute_path($confdir)! validate_absolute_path($conffile)! file { $confdir:! ensure => directory,! }! file { $conffile:! ensure => file,! content => template(’apache/apache.conf.erb’),! }! }
  • 23. Presented by Validation • Functions in puppetlabs-stdlib • Never pass unvalidated data to resources
  • 25. Presented by class mysql::server (! ## params here! ) inherits mysql::params {! ! include ::mysql::server::install! include ::mysql::server::config! include ::mysql::server::service! ! }
  • 26. Presented by class mysql::server (! ## params here! ) inherits mysql::params {! ! include ::mysql::server::install! include ::mysql::server::config! include ::mysql::server::service! ! anchor { ‘mysql:start’: }! -> Class[‘mysql::server::install’]! -> Class[‘mysql::server::config’]! -> Class[‘mysql::server::service’]! -> anchor { ‘mysql:end’: }! }
  • 27. Presented by class mysql::server (! ## params here! ) inherits mysql::params {! ! contain ::mysql::server::install! contain ::mysql::server::config! contain ::mysql::server::service! ! } * Puppet ≥ 3.4.0
  • 28. Presented by Class containment • Before Puppet 3.4.0 - use anchors • After Puppet 3.4.0 - use contain
  • 30. Presented by class data_in_code {! case $::application_tier {! 'dev': {! $java_version = '6.0.3'! $tomcat_version = '6.0'! }! ! 'test': {! $java_version = '7.0.1'! $tomcat_version = '7.0'! }! }! }
  • 31. class data_in_code {! $java_version = hiera(’java_version’)! $tomcat_version = hiera(’tomcat_version’)! } Presented by
  • 32. Presented by hiera.yaml --- :backends: - yaml :yaml: :datadir: /etc/puppetlabs/puppet/hieradata :hierarchy: - “nodes/%{::clientcert}” - “location/%{::location}" - “tier/%{::application_tier}" - common
  • 33. Presented by --- java_version: 7.0 tomcat_version: 8.0 dev.yaml --- java_version: 6.0 tomcat_version: 7.0 prod.yaml
  • 35. Presented by What’s an Application
  • 36. ‘Application tier’ • Long lived • Data usually separate • ‘The Data’ Presented by ! ! ! ‘Environment’ • Short lived • Migration path to ‘production’ • ‘The Model’ ! ! !
  • 37. Presented by Hierarchy structure? • How/where is data different? • Most -> least specific • Folders are your friends
  • 39. Presented by But first…
  • 40. Presented by include apache! vs.! class { ‘apache’: }!
  • 41. Presented by include apache! include apache! include apache! include apache! include apache!
  • 42. Presented by class { ‘apache’: }! include apache!
  • 43. Presented by include apache! class { ‘apache’: }! include apache!
  • 45. class data_in_code {! $java_version = hiera(’java_version’)! $tomcat_version = hiera(’tomcat_version’)! ! notify { “Java is: ${java_version}”: }! } Presented by
  • 46. Presented by class data_in_code {! $java_version = hiera(’java_version’)! $tomcat_version = hiera(’tomcat_version’)! ! notify { “Java is: ${data_in_code::java_version}”: }! }
  • 47. class profiles::jenkins {! include jenkins! } Presented by
  • 48. class profiles::jenkins {! include ???????! } Presented by
  • 49. class profiles::jenkins {! include ::jenkins! } Presented by
  • 51. Presented by class data_in_code {! case $::application_tier {! 'dev': {! $java_version = '6.0.3'! $tomcat_version = '6.0'! }! ! 'test': {! $java_version = '7.0.1'! $tomcat_version = '7.0'! }! }! }
  • 52. Presented by class profiles::tomcat {! $java_version = hiera(’java_version’)! $tomcat_version = hiera(’tomcat_version’)! ! class { ’::tomcat’:! version => $tomcat_version,! }! ! class { ’::java’:! version => $java_version,! }! }
  • 53. Presented by class apache {! file { ‘/opt/custom/key.pem’:! ensure => file,! source => ’puppet:///modules/apache/key.pem'! }! ! file { ‘/things/that/dont/belong/in/apache’:! ensure => file,! source => ’puppet:///modules/apache/blargh'! } ! }
  • 54. Presented by class profiles::apache {! include apache! $keypath = hiera(’apache_keypath’)! ! file { “${keypath}/key.pem”:! ensure => file,! source => ’puppet:///modules/profiles/key.pem'! }! ! file { ‘/things/that/dont/belong/in/apache’:! ensure => file,! source => ’puppet:///modules/profiles/blargh'! }! }
  • 56. Presented by class tomcat {! class { ‘java’:! version => ‘6.0’,! }! ! Class[‘java’]! -> Class[‘tomcat’]! }
  • 57. Presented by class profiles::tomcat {! $java_version = hiera(’java_version’)! $tomcat_version = hiera(’tomcat_version’)! ! class { ‘::java’:! version => $java_version,! }! class { ‘::tomcat’:! version => $tomcat_version,! }! ! Class[‘::java’]! -> Class[‘::tomcat’]! }
  • 58. class profiles::tomcat {! include profiles::java! $tomcat_version = hiera(’tomcat_version’)! ! class { ‘::tomcat’:! Presented by version => $tomcat_version,! }! ! Class[‘profiles::java’]! -> Class[‘::tomcat’]! }
  • 59. Presented by Profiles • Hiera for business-specific data • Proprietary resources • Inter-class dependencies and containment
  • 64. class roles {! include profiles::security::base! include profiles::mycorp::users! include profiles::mycorp::os_base! } Presented by
  • 65. class roles::app_server inherits roles {! include profiles::tomcat! include profiles::our_app! include profiles::shibboleth! Presented by ! Class[‘profiles::tomcat’]! -> Class[‘profiles::our_app’]! -> Class[‘profiles::shibboleth’]! }
  • 66. class roles::app_server::pci inherits roles::app_server {! include profiles::pci! } Presented by
  • 67. Presented by class roles::app_server::pci {! include profiles::security::base! include profiles::mycorp::users! include profiles::mycorp::os_base! include profiles::pci! include profiles::tomcat! include profiles::our_app! include profiles::shibboleth! include profiles::pci! ! Class[‘profiles::java’]! -> Class[‘profiles::our_app’]! -> Class[‘profiles::shibboleth’]! }
  • 68. Presented by Roles • Hostnames minus Hiera • Technology-independent • Inheritance makes sense (or not)
  • 71. forge "http://forge.puppetlabs.com"! ! # Modules from the Puppet Forge! mod "puppetlabs/apache"! mod "puppetlabs/ntp"! ! # Modules from Github using various references! mod 'notifyme',! :git => 'git://github.com/glarizza/puppet-notifyme',! :ref => '50c01703b2e3e352520a9a2271ea4947fe17a51f'! ! mod 'profiles',! :git => 'git://github.com/glarizza/puppet-profiles',! :ref => '3611ae4253ff01762f9bda1d93620edf8f9a3b22' Presented by
  • 72. R10k - Bad name, good robot 1. Ensuring modules based on a Puppetfile 2. Dynamically creating Puppet environments Presented by
  • 73. Presented by Puppetfile Manifest Hieradata Control Repository
  • 74. Presented by Puppetfile Manifest Hieradata Puppetfile Manifest Hieradata Puppetfile Manifest Hieradata
  • 75. Presented by Puppetfile Manifest Hieradata Branch Branch Puppetfile Manifest Hieradata Puppetfile Manifest Hieradata Puppet Environment Puppet Environment
  • 77. Presented by Summary • Simple, generic component modules • Extract company-specific data with Hiera • Layer implementation with Profiles • Classification with Profiles