SlideShare a Scribd company logo
1 of 41
Download to read offline
Puppet 4: The Low WAT-tage
Edition
Nick Fagerlund, Puppet
nickf@puppet.com
@nfagerlund
nfagerlund.net
2
Hi, I’m Nick Fagerlund!!!!
I’ve seen things you people wouldn’t believe
My 2013 talk: https://www.youtube.com/watch?v=aU7vjKYqMUo
My much smarter inspiration: https://www.destroyallsoftware.com/talks/wat
3
Agenda
4
Agenda
1. Fundamental Chaos
2. Slapstick
3. Elegance
5
1. Fundamental Chaos
6
Relative Namespacing
class profile::apache {
include apache
}
7
Relative Namespacing
class profile::apache {
class {'apache':}
}
8
Relative Namespacing
include apache meant…
• <CURRENT NAMESPACE>::apache
• <PARENT OF CURRENT NAMESPACE>::apache
• etc. and so on
• Eventually, ::apache
https://projects.puppetlabs.com/issues/2053
https://tickets.puppetlabs.com/browse/PUP-121
9
Relative Namespacing
class profile::apache {
include ::apache
}
10
Is Truth Beauty, and Beauty Truth?
Facts:
architecture => x86_64
domain => local
facterversion => 2.4.2
fqdn => "treepie.local"
gid => staff
hardwareisa => i386
hardwaremodel => x86_64
hostname => treepie
11
Is Truth Beauty, and Beauty Truth?
if $::is_virtual {
# do something
}
12
Is Truth Beauty, and Beauty Truth?
“false”
13
Is Truth Beauty, and Beauty Truth?
if $::is_virtual == 'true' { ... }
# or:
if str2bool($::is_virtual) { ... }
# with the str2bool() function
from puppetlabs/stdlib
14
Is Truth Beauty, and Beauty Truth?
$interfaces =
lo0,gif0,stf0,en0,en1,en2,p2p0,awdl0,
bridge0,utun0
$macaddress_en0 = 72:00:04:eb:7a:93
...etc.
15
2. Slapstick
16
Data Type Nonsense
$myvar = /^# @.*$/
notice($myvar)
# Error: …Syntax error at
'/' at /root/test.pp:1
17
Data Type Nonsense
$one = 1
# String
$one_times_one = 1*1
# Fixnum
$an_undef = undef
# NilClass
$multi_undefs = [undef, undef]
# Symbol (:undef)
18
Interpolation Shenanigans
notice("Twenty plus eighty is ${20 + 80}.")
# Error: left operand of + is not a number at
/root/test.pp:15
19
Interpolation Shenanigans
notice("Twenty plus eighty is ${'20' + 80}.")
# Notice: Scope(Class[main]): Twenty plus
eighty is 100.
20
Interpolation Shenanigans
• Single bare word:
• ${variable}
• Bare word plus chained function call:
• ${variable.split(‘,’)}
• That’s it. Otherwise it’s an expression.
21
Inconsistent Comparisons
notice( 'eat' == 'EAt' ) # true
notice( 'eat' in 'EAten' ) # false
22
The Great Escape
$greeting = 'How's it going?'
23
The Great Escape
$s32path = 'C:WindowsSystem32'
notice($s32path)
# Error: Unclosed quote after ''
in 'C:WindowsSystem32'
24
The Great Escape
$s32path = 'C:WindowsSystem32'
notice($s32path)
# Notice: Scope(Class[main]):
C:WindowsSystem32
>:c
25
The Great Escape
$gitconfig = @("GITCONFIG"/L)
[user]
name = ${displayname}
email = ${email}
[alias]
lg = "log —pretty=format:’%C(yellow)%h
%C(reset) %s%C(cyan)%cr%C(reset) %C(blue)%an
%C(reset) %C(green)%d%C(reset)’ --graph"
| GITCONFIG
26
The Great Escape
$s32path = @(MYPATH)
C:WindowsSystem32
-MYPATH
notice($s32path)
# Notice: Scope(Class[main]):
C:WindowsSystem32
27
Class Class
class class {
notify {'hey it worked':}
}
include class
# Error: Syntax error at 'class' at
/root/test.pp:5
28
Class Class
class class {
notify {'hey it worked':}
}
include "class"
# Notice: hey it worked
# Notice: /Stage[main]/Class/Notify[hey it
worked]/message: defined 'message' as 'hey it
worked'
29
Class Class
class class {
notify {'hey it worked':}
}
include "class"
# Error: 'class' is not a valid classname
at /Users/nick/Desktop/test.pp:1:7
30
3. Elegance
31
Data Type Annotations
class ntp (
$autoupdate = $ntp::params::autoupdate,
$config = $ntp::params::config,
$config_template = $ntp::params::config_template,
$disable_monitor = $ntp::params::disable_monitor,
$driftfile = $ntp::params::driftfile,
$logfile = $ntp::params::logfile,
$iburst_enable = $ntp::params::iburst_enable,
$keys_enable = $ntp::params::keys_enable,
$keys_file = $ntp::params::keys_file,
$keys_controlkey = $ntp::params::keys_controlkey,
$keys_requestkey = $ntp::params::keys_requestkey,
$keys_trusted = $ntp::params::keys_trusted,
$package_ensure = $ntp::params::package_ensure,
$package_name = $ntp::params::package_name,
$panic = $ntp::params::panic,
$preferred_servers = $ntp::params::preferred_servers,
$restrict = $ntp::params::restrict,
$interfaces = $ntp::params::interfaces,
$servers = $ntp::params::servers,
$service_enable = $ntp::params::service_enable,
$service_ensure = $ntp::params::service_ensure,
$service_manage = $ntp::params::service_manage,
$service_name = $ntp::params::service_name,
$udlc = $ntp::params::udlc
) inherits ntp::params {
...
32
...
validate_absolute_path($config)
validate_string($config_template)
validate_bool($disable_monitor)
validate_absolute_path($driftfile)
if $logfile { validate_absolute_path($logfile) }
validate_bool($iburst_enable)
validate_bool($keys_enable)
validate_re($keys_controlkey, ['^d+$', ''])
validate_re($keys_requestkey, ['^d+$', ''])
validate_array($keys_trusted)
validate_string($package_ensure)
validate_array($package_name)
validate_bool($panic)
validate_array($preferred_servers)
validate_array($restrict)
validate_array($interfaces)
validate_array($servers)
validate_bool($service_enable)
validate_string($service_ensure)
validate_bool($service_manage)
validate_string($service_name)
validate_bool($udlc)
Data Type Annotations
~~~~ 👀 ZOOM AND ENHANCE 👀 ~~~~
class ntp (
$config_template = $ntp::params::config_template,
$disable_monitor = $ntp::params::disable_monitor,
...
) inherits ntp::params {
...
validate_string($config_template)
validate_bool($disable_monitor)
33
Data Type Annotations
class ntp (
Boolean $disable_monitor =
$ntp::params::disable_monitor,
Pattern[/^d+$/] $keys_controlkey =
$ntp::params::keys_controlkey,
Integer $keys_requestkey =
$ntp::params::keys_requestkey,
Array $keys_trusted =
$ntp::params::keys_trusted,
String $package_ensure =
$ntp::params::package_ensure,
34
Iteration
•Old Ruby DSL?
•Do-nothing defined types?
•create_resources function?
35
Data Type Annotations
# in Hiera data:
admin_users:
casey:
uid: '1330'
gid: allstaff
shell: zsh
groups:
- developers
- release
leslie:
uid: '1308'
gid: allstaff
groups:
- prosvc
36
# in Puppet manifest:
class puppet_ops::users::virtual {
create_resources(
'@user',
lookup('admin_users'),
{ # defaults
ensure => present,
purge_ssh_keys => true,
}
)
}
Iteration
$binaries = ['facter', 'hiera', 'mco', ‘puppet',
'puppetserver']
$binaries.each |String $binary| {
file { "/usr/bin/${binary}":
ensure => link,
target => "/opt/puppetlabs/bin/${binary}",
}
}
37
EPP Templates
<%- | Boolean $keys_enable,
String $keys_file,
Array $keys_trusted,
String $keys_requestkey,
String $keys_controlkey
| -%>
<%# Parameter tag ↑ -%>
<%# Non-printing tag ↓ -%>
<% if $keys_enable { -%>
<%# Expression-printing tag ↓ -%>
keys <%= $keys_file %>
38
<% unless $keys_trusted =~ Array[Data,0,0]
{ -%>
trustedkey <%= $keys_trusted.join(' ') %>
<% } -%>
<% if $keys_requestkey =~ String[1] { -%>
requestkey <%= $keys_requestkey %>
<% } -%>
<% if $keys_controlkey =~ String[1] { -%>
controlkey <%= $keys_controlkey %>
<% } -%>
<% } -%>
Thanks
39
Questions?
nickf@puppet.com
@nfagerlund
nfagerlund.net
40
PuppetConf 2016: Puppet 4.x: The Low WAT-tage Edition – Nick Fagerlund, Puppet

More Related Content

What's hot

Metasploit magic the dark coners of the framework
Metasploit magic   the dark coners of the frameworkMetasploit magic   the dark coners of the framework
Metasploit magic the dark coners of the framework
Rob Fuller
 
Installaling Puppet Master and Agent
Installaling Puppet Master and AgentInstallaling Puppet Master and Agent
Installaling Puppet Master and Agent
Ranjit Avasarala
 
Vagrant + Rouster at salesforce.com - PuppetConf 2013
Vagrant + Rouster at salesforce.com - PuppetConf 2013Vagrant + Rouster at salesforce.com - PuppetConf 2013
Vagrant + Rouster at salesforce.com - PuppetConf 2013
Puppet
 
How to deploy node to production
How to deploy node to productionHow to deploy node to production
How to deploy node to production
Sean Hess
 

What's hot (20)

The Dirty Little Secrets They Didn’t Teach You In Pentesting Class
The Dirty Little Secrets They Didn’t Teach You In Pentesting ClassThe Dirty Little Secrets They Didn’t Teach You In Pentesting Class
The Dirty Little Secrets They Didn’t Teach You In Pentesting Class
 
DNN Upgrades Made Simple (DNN Summit 2019)
DNN Upgrades Made Simple (DNN Summit 2019)DNN Upgrades Made Simple (DNN Summit 2019)
DNN Upgrades Made Simple (DNN Summit 2019)
 
C++ for the Web
C++ for the WebC++ for the Web
C++ for the Web
 
ABCs of docker
ABCs of dockerABCs of docker
ABCs of docker
 
Everything as a code
Everything as a codeEverything as a code
Everything as a code
 
Puppet evolutions
Puppet evolutionsPuppet evolutions
Puppet evolutions
 
Why and How Powershell will rule the Command Line - Barcamp LA 4
Why and How Powershell will rule the Command Line - Barcamp LA 4Why and How Powershell will rule the Command Line - Barcamp LA 4
Why and How Powershell will rule the Command Line - Barcamp LA 4
 
Metasploit magic the dark coners of the framework
Metasploit magic   the dark coners of the frameworkMetasploit magic   the dark coners of the framework
Metasploit magic the dark coners of the framework
 
Write book in markdown
Write book in markdownWrite book in markdown
Write book in markdown
 
Migration from ASP to ASP.NET
Migration from ASP to ASP.NETMigration from ASP to ASP.NET
Migration from ASP to ASP.NET
 
Lviv 2013 d7 vs d8
Lviv 2013   d7 vs d8Lviv 2013   d7 vs d8
Lviv 2013 d7 vs d8
 
Cool Jvm Tools to Help you Test - Aylesbury Testers Version
Cool Jvm Tools to Help you Test - Aylesbury Testers VersionCool Jvm Tools to Help you Test - Aylesbury Testers Version
Cool Jvm Tools to Help you Test - Aylesbury Testers Version
 
Continuous Delivery: The Next Frontier
Continuous Delivery: The Next FrontierContinuous Delivery: The Next Frontier
Continuous Delivery: The Next Frontier
 
Installaling Puppet Master and Agent
Installaling Puppet Master and AgentInstallaling Puppet Master and Agent
Installaling Puppet Master and Agent
 
Drupal, Memcache and Solr on Windows
Drupal, Memcache and Solr on WindowsDrupal, Memcache and Solr on Windows
Drupal, Memcache and Solr on Windows
 
Vagrant + Rouster at salesforce.com - PuppetConf 2013
Vagrant + Rouster at salesforce.com - PuppetConf 2013Vagrant + Rouster at salesforce.com - PuppetConf 2013
Vagrant + Rouster at salesforce.com - PuppetConf 2013
 
C make tutorial
C make tutorialC make tutorial
C make tutorial
 
PHP: The Beginning and the Zend
PHP: The Beginning and the ZendPHP: The Beginning and the Zend
PHP: The Beginning and the Zend
 
How to deploy node to production
How to deploy node to productionHow to deploy node to production
How to deploy node to production
 
Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014
 

Viewers also liked

Viewers also liked (17)

PuppetConf 2016: Testing and Delivering Puppet – Michael Stahnke, Puppet
PuppetConf 2016: Testing and Delivering Puppet – Michael Stahnke, PuppetPuppetConf 2016: Testing and Delivering Puppet – Michael Stahnke, Puppet
PuppetConf 2016: Testing and Delivering Puppet – Michael Stahnke, Puppet
 
PuppetConf 2016: Easily Manage Software on Windows with Chocolatey – Rob Reyn...
PuppetConf 2016: Easily Manage Software on Windows with Chocolatey – Rob Reyn...PuppetConf 2016: Easily Manage Software on Windows with Chocolatey – Rob Reyn...
PuppetConf 2016: Easily Manage Software on Windows with Chocolatey – Rob Reyn...
 
PuppetConf 2016: Collaboration and Empowerment: Driving Change in Infrastruct...
PuppetConf 2016: Collaboration and Empowerment: Driving Change in Infrastruct...PuppetConf 2016: Collaboration and Empowerment: Driving Change in Infrastruct...
PuppetConf 2016: Collaboration and Empowerment: Driving Change in Infrastruct...
 
Puppet at GitHub
Puppet at GitHubPuppet at GitHub
Puppet at GitHub
 
Configuration Changes Don't Have to be Scary: Testing with containers
Configuration Changes Don't Have to be Scary: Testing with containersConfiguration Changes Don't Have to be Scary: Testing with containers
Configuration Changes Don't Have to be Scary: Testing with containers
 
Plugging Chocolatey into your Puppet Infrastructure PuppetConf2014
Plugging Chocolatey into your Puppet Infrastructure PuppetConf2014Plugging Chocolatey into your Puppet Infrastructure PuppetConf2014
Plugging Chocolatey into your Puppet Infrastructure PuppetConf2014
 
Introducion to Puppet Enterprise
Introducion to Puppet EnterpriseIntroducion to Puppet Enterprise
Introducion to Puppet Enterprise
 
PuppetConf 2016: An Introduction to Measuring and Tuning PE Performance – Cha...
PuppetConf 2016: An Introduction to Measuring and Tuning PE Performance – Cha...PuppetConf 2016: An Introduction to Measuring and Tuning PE Performance – Cha...
PuppetConf 2016: An Introduction to Measuring and Tuning PE Performance – Cha...
 
Canadian Cyber Cecurity
Canadian Cyber CecurityCanadian Cyber Cecurity
Canadian Cyber Cecurity
 
PuppetConf 2016: Best Practices for Puppet in the Cloud – Randall Hunt, Amazo...
PuppetConf 2016: Best Practices for Puppet in the Cloud – Randall Hunt, Amazo...PuppetConf 2016: Best Practices for Puppet in the Cloud – Randall Hunt, Amazo...
PuppetConf 2016: Best Practices for Puppet in the Cloud – Randall Hunt, Amazo...
 
PuppetConf 2016: The Long, Twisty Road to Automation: Implementing Puppet at ...
PuppetConf 2016: The Long, Twisty Road to Automation: Implementing Puppet at ...PuppetConf 2016: The Long, Twisty Road to Automation: Implementing Puppet at ...
PuppetConf 2016: The Long, Twisty Road to Automation: Implementing Puppet at ...
 
Pro Puppet
Pro PuppetPro Puppet
Pro Puppet
 
PuppetConf 2016: High Availability for Puppet – Russ Mull & Zack Smith, Puppet
PuppetConf 2016: High Availability for Puppet – Russ Mull & Zack Smith, PuppetPuppetConf 2016: High Availability for Puppet – Russ Mull & Zack Smith, Puppet
PuppetConf 2016: High Availability for Puppet – Russ Mull & Zack Smith, Puppet
 
PuppetConf. 2016: Puppet Best Practices: Roles & Profiles – Gary Larizza, Puppet
PuppetConf. 2016: Puppet Best Practices: Roles & Profiles – Gary Larizza, PuppetPuppetConf. 2016: Puppet Best Practices: Roles & Profiles – Gary Larizza, Puppet
PuppetConf. 2016: Puppet Best Practices: Roles & Profiles – Gary Larizza, Puppet
 
PuppetConf 2016: Successful Puppet Implementation in Large Organizations – Ja...
PuppetConf 2016: Successful Puppet Implementation in Large Organizations – Ja...PuppetConf 2016: Successful Puppet Implementation in Large Organizations – Ja...
PuppetConf 2016: Successful Puppet Implementation in Large Organizations – Ja...
 
PuppetConf 2016: Puppet and vRealize Automation: The Next Generation – Ganesh...
PuppetConf 2016: Puppet and vRealize Automation: The Next Generation – Ganesh...PuppetConf 2016: Puppet and vRealize Automation: The Next Generation – Ganesh...
PuppetConf 2016: Puppet and vRealize Automation: The Next Generation – Ganesh...
 
Introduction to Puppet Enterprise
Introduction to Puppet EnterpriseIntroduction to Puppet Enterprise
Introduction to Puppet Enterprise
 

Similar to PuppetConf 2016: Puppet 4.x: The Low WAT-tage Edition – Nick Fagerlund, Puppet

Sergei Stryukov.Drush.Why it should be used.DrupalCamp Kyiv 2011
Sergei Stryukov.Drush.Why it should be used.DrupalCamp Kyiv 2011Sergei Stryukov.Drush.Why it should be used.DrupalCamp Kyiv 2011
Sergei Stryukov.Drush.Why it should be used.DrupalCamp Kyiv 2011
camp_drupal_ua
 
Drush. Why should it be used?
Drush. Why should it be used?Drush. Why should it be used?
Drush. Why should it be used?
Sergei Stryukov
 
Puppet Troubleshooting
Puppet TroubleshootingPuppet Troubleshooting
Puppet Troubleshooting
Puppet
 
Auto-loading of Drupal CCK Nodes
Auto-loading of Drupal CCK NodesAuto-loading of Drupal CCK Nodes
Auto-loading of Drupal CCK Nodes
nihiliad
 

Similar to PuppetConf 2016: Puppet 4.x: The Low WAT-tage Edition – Nick Fagerlund, Puppet (20)

Sergei Stryukov.Drush.Why it should be used.DrupalCamp Kyiv 2011
Sergei Stryukov.Drush.Why it should be used.DrupalCamp Kyiv 2011Sergei Stryukov.Drush.Why it should be used.DrupalCamp Kyiv 2011
Sergei Stryukov.Drush.Why it should be used.DrupalCamp Kyiv 2011
 
Chef for beginners module 2
Chef for beginners   module 2Chef for beginners   module 2
Chef for beginners module 2
 
Drush. Why should it be used?
Drush. Why should it be used?Drush. Why should it be used?
Drush. Why should it be used?
 
Test-Driven Puppet Development - PuppetConf 2014
Test-Driven Puppet Development - PuppetConf 2014Test-Driven Puppet Development - PuppetConf 2014
Test-Driven Puppet Development - PuppetConf 2014
 
Ext 0523
Ext 0523Ext 0523
Ext 0523
 
Writing your own augeasproviders
Writing your own augeasprovidersWriting your own augeasproviders
Writing your own augeasproviders
 
David Convent - Theme It Yourself
David Convent - Theme It YourselfDavid Convent - Theme It Yourself
David Convent - Theme It Yourself
 
Puppet Troubleshooting
Puppet TroubleshootingPuppet Troubleshooting
Puppet Troubleshooting
 
Troubleshooting Puppet
Troubleshooting PuppetTroubleshooting Puppet
Troubleshooting Puppet
 
Intro to-puppet
Intro to-puppetIntro to-puppet
Intro to-puppet
 
Writing and Publishing Puppet Modules - PuppetConf 2014
Writing and Publishing Puppet Modules - PuppetConf 2014Writing and Publishing Puppet Modules - PuppetConf 2014
Writing and Publishing Puppet Modules - PuppetConf 2014
 
Puppet Design Patterns - PuppetConf
Puppet Design Patterns - PuppetConfPuppet Design Patterns - PuppetConf
Puppet Design Patterns - PuppetConf
 
Learn flask in 90mins
Learn flask in 90minsLearn flask in 90mins
Learn flask in 90mins
 
Growing pains - PosKeyErrors and other malaises
Growing pains - PosKeyErrors and other malaisesGrowing pains - PosKeyErrors and other malaises
Growing pains - PosKeyErrors and other malaises
 
Containerize spring boot application with docker
Containerize spring boot application with dockerContainerize spring boot application with docker
Containerize spring boot application with docker
 
PuppetConf 2016: Deconfiguration Management: Making Puppet Clean Up Its Own M...
PuppetConf 2016: Deconfiguration Management: Making Puppet Clean Up Its Own M...PuppetConf 2016: Deconfiguration Management: Making Puppet Clean Up Its Own M...
PuppetConf 2016: Deconfiguration Management: Making Puppet Clean Up Its Own M...
 
Auto-loading of Drupal CCK Nodes
Auto-loading of Drupal CCK NodesAuto-loading of Drupal CCK Nodes
Auto-loading of Drupal CCK Nodes
 
MobileConf 2021 Slides: Let's build macOS CLI Utilities using Swift
MobileConf 2021 Slides:  Let's build macOS CLI Utilities using SwiftMobileConf 2021 Slides:  Let's build macOS CLI Utilities using Swift
MobileConf 2021 Slides: Let's build macOS CLI Utilities using Swift
 
Zero Downtime Deployment with Ansible
Zero Downtime Deployment with AnsibleZero Downtime Deployment with Ansible
Zero Downtime Deployment with Ansible
 
Puppet Node Classifiers Talk - Patrick Buckley
Puppet Node Classifiers Talk - Patrick BuckleyPuppet Node Classifiers Talk - Patrick Buckley
Puppet Node Classifiers Talk - Patrick Buckley
 

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 controlrepo
Puppet
 
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
 
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
Puppet
 

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

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Recently uploaded (20)

DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
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
 

PuppetConf 2016: Puppet 4.x: The Low WAT-tage Edition – Nick Fagerlund, Puppet

  • 1. Puppet 4: The Low WAT-tage Edition Nick Fagerlund, Puppet
  • 3. I’ve seen things you people wouldn’t believe My 2013 talk: https://www.youtube.com/watch?v=aU7vjKYqMUo My much smarter inspiration: https://www.destroyallsoftware.com/talks/wat 3
  • 5. Agenda 1. Fundamental Chaos 2. Slapstick 3. Elegance 5
  • 9. Relative Namespacing include apache meant… • <CURRENT NAMESPACE>::apache • <PARENT OF CURRENT NAMESPACE>::apache • etc. and so on • Eventually, ::apache https://projects.puppetlabs.com/issues/2053 https://tickets.puppetlabs.com/browse/PUP-121 9
  • 11. Is Truth Beauty, and Beauty Truth? Facts: architecture => x86_64 domain => local facterversion => 2.4.2 fqdn => "treepie.local" gid => staff hardwareisa => i386 hardwaremodel => x86_64 hostname => treepie 11
  • 12. Is Truth Beauty, and Beauty Truth? if $::is_virtual { # do something } 12
  • 13. Is Truth Beauty, and Beauty Truth? “false” 13
  • 14. Is Truth Beauty, and Beauty Truth? if $::is_virtual == 'true' { ... } # or: if str2bool($::is_virtual) { ... } # with the str2bool() function from puppetlabs/stdlib 14
  • 15. Is Truth Beauty, and Beauty Truth? $interfaces = lo0,gif0,stf0,en0,en1,en2,p2p0,awdl0, bridge0,utun0 $macaddress_en0 = 72:00:04:eb:7a:93 ...etc. 15
  • 17. Data Type Nonsense $myvar = /^# @.*$/ notice($myvar) # Error: …Syntax error at '/' at /root/test.pp:1 17
  • 18. Data Type Nonsense $one = 1 # String $one_times_one = 1*1 # Fixnum $an_undef = undef # NilClass $multi_undefs = [undef, undef] # Symbol (:undef) 18
  • 19. Interpolation Shenanigans notice("Twenty plus eighty is ${20 + 80}.") # Error: left operand of + is not a number at /root/test.pp:15 19
  • 20. Interpolation Shenanigans notice("Twenty plus eighty is ${'20' + 80}.") # Notice: Scope(Class[main]): Twenty plus eighty is 100. 20
  • 21. Interpolation Shenanigans • Single bare word: • ${variable} • Bare word plus chained function call: • ${variable.split(‘,’)} • That’s it. Otherwise it’s an expression. 21
  • 22. Inconsistent Comparisons notice( 'eat' == 'EAt' ) # true notice( 'eat' in 'EAten' ) # false 22
  • 23. The Great Escape $greeting = 'How's it going?' 23
  • 24. The Great Escape $s32path = 'C:WindowsSystem32' notice($s32path) # Error: Unclosed quote after '' in 'C:WindowsSystem32' 24
  • 25. The Great Escape $s32path = 'C:WindowsSystem32' notice($s32path) # Notice: Scope(Class[main]): C:WindowsSystem32 >:c 25
  • 26. The Great Escape $gitconfig = @("GITCONFIG"/L) [user] name = ${displayname} email = ${email} [alias] lg = "log —pretty=format:’%C(yellow)%h %C(reset) %s%C(cyan)%cr%C(reset) %C(blue)%an %C(reset) %C(green)%d%C(reset)’ --graph" | GITCONFIG 26
  • 27. The Great Escape $s32path = @(MYPATH) C:WindowsSystem32 -MYPATH notice($s32path) # Notice: Scope(Class[main]): C:WindowsSystem32 27
  • 28. Class Class class class { notify {'hey it worked':} } include class # Error: Syntax error at 'class' at /root/test.pp:5 28
  • 29. Class Class class class { notify {'hey it worked':} } include "class" # Notice: hey it worked # Notice: /Stage[main]/Class/Notify[hey it worked]/message: defined 'message' as 'hey it worked' 29
  • 30. Class Class class class { notify {'hey it worked':} } include "class" # Error: 'class' is not a valid classname at /Users/nick/Desktop/test.pp:1:7 30
  • 32. Data Type Annotations class ntp ( $autoupdate = $ntp::params::autoupdate, $config = $ntp::params::config, $config_template = $ntp::params::config_template, $disable_monitor = $ntp::params::disable_monitor, $driftfile = $ntp::params::driftfile, $logfile = $ntp::params::logfile, $iburst_enable = $ntp::params::iburst_enable, $keys_enable = $ntp::params::keys_enable, $keys_file = $ntp::params::keys_file, $keys_controlkey = $ntp::params::keys_controlkey, $keys_requestkey = $ntp::params::keys_requestkey, $keys_trusted = $ntp::params::keys_trusted, $package_ensure = $ntp::params::package_ensure, $package_name = $ntp::params::package_name, $panic = $ntp::params::panic, $preferred_servers = $ntp::params::preferred_servers, $restrict = $ntp::params::restrict, $interfaces = $ntp::params::interfaces, $servers = $ntp::params::servers, $service_enable = $ntp::params::service_enable, $service_ensure = $ntp::params::service_ensure, $service_manage = $ntp::params::service_manage, $service_name = $ntp::params::service_name, $udlc = $ntp::params::udlc ) inherits ntp::params { ... 32 ... validate_absolute_path($config) validate_string($config_template) validate_bool($disable_monitor) validate_absolute_path($driftfile) if $logfile { validate_absolute_path($logfile) } validate_bool($iburst_enable) validate_bool($keys_enable) validate_re($keys_controlkey, ['^d+$', '']) validate_re($keys_requestkey, ['^d+$', '']) validate_array($keys_trusted) validate_string($package_ensure) validate_array($package_name) validate_bool($panic) validate_array($preferred_servers) validate_array($restrict) validate_array($interfaces) validate_array($servers) validate_bool($service_enable) validate_string($service_ensure) validate_bool($service_manage) validate_string($service_name) validate_bool($udlc)
  • 33. Data Type Annotations ~~~~ 👀 ZOOM AND ENHANCE 👀 ~~~~ class ntp ( $config_template = $ntp::params::config_template, $disable_monitor = $ntp::params::disable_monitor, ... ) inherits ntp::params { ... validate_string($config_template) validate_bool($disable_monitor) 33
  • 34. Data Type Annotations class ntp ( Boolean $disable_monitor = $ntp::params::disable_monitor, Pattern[/^d+$/] $keys_controlkey = $ntp::params::keys_controlkey, Integer $keys_requestkey = $ntp::params::keys_requestkey, Array $keys_trusted = $ntp::params::keys_trusted, String $package_ensure = $ntp::params::package_ensure, 34
  • 35. Iteration •Old Ruby DSL? •Do-nothing defined types? •create_resources function? 35
  • 36. Data Type Annotations # in Hiera data: admin_users: casey: uid: '1330' gid: allstaff shell: zsh groups: - developers - release leslie: uid: '1308' gid: allstaff groups: - prosvc 36 # in Puppet manifest: class puppet_ops::users::virtual { create_resources( '@user', lookup('admin_users'), { # defaults ensure => present, purge_ssh_keys => true, } ) }
  • 37. Iteration $binaries = ['facter', 'hiera', 'mco', ‘puppet', 'puppetserver'] $binaries.each |String $binary| { file { "/usr/bin/${binary}": ensure => link, target => "/opt/puppetlabs/bin/${binary}", } } 37
  • 38. EPP Templates <%- | Boolean $keys_enable, String $keys_file, Array $keys_trusted, String $keys_requestkey, String $keys_controlkey | -%> <%# Parameter tag ↑ -%> <%# Non-printing tag ↓ -%> <% if $keys_enable { -%> <%# Expression-printing tag ↓ -%> keys <%= $keys_file %> 38 <% unless $keys_trusted =~ Array[Data,0,0] { -%> trustedkey <%= $keys_trusted.join(' ') %> <% } -%> <% if $keys_requestkey =~ String[1] { -%> requestkey <%= $keys_requestkey %> <% } -%> <% if $keys_controlkey =~ String[1] { -%> controlkey <%= $keys_controlkey %> <% } -%> <% } -%>