SlideShare a Scribd company logo
Text
The Power of Puppet 4
Martin Alfke
ma@example42.com
About me
PL Training Partner
Module Contributor
Automation Enthusiast
Puppet Server &
Packaging
Environments
New language features
Types, Types, Types
Deprecations
The 4 Powers of Puppet
4
Puppet Server & Packages
Puppet Server on JVM
Closure
Trapperkeeper
JMX & internal metrics
(PE only)
Puppet Packaging
AIO - like PE
New package name
Discussion on mailinglist
Environments
Config environments
Static puppet.conf
[production]
modulepath = /etc/puppet/production/modules
manifests = /etc/puppet/production/manifests/site.pp
!
[test]
modulepath = /etc/puppet/test/modules
manifests = /etc/puppet/test/manifests/site.pp
Config environments
Dynamic puppet.conf
[master]
modulepath = /etc/puppet/$environment/modules
manifests = /etc/puppet/$environment/manifests/site.pp
!
Directory environments
puppet.conf
[master]
environmentpath = /etc/puppet/environments
!
File system
/etc/puppet/environments/
	 	 	 	 	 production/
	 	 	 	 	 	 	 modules/
	 	 	 	 	 	 	 manifests/
	 	 	 	 	 	 	 environment.conf
	 	 	 	 	 test/
	 	 	 	 	 	 	 modules/
	 	 	 	 	 	 	 manifests/
Directory
Benefits
All environments in one place
Per environment configuration (environment.conf)
config_version = '/usr/bin/git --git-dir /etc/puppet/environments/
$environment/.git rev-parse HEAD'
Newly added environments are available immediately
r10k
Robot 10000
Manage environment in git branches
Puppetfile handles modules and versions
New language features
Lambdas
Lambda
“a block of code that has parameters and can be invoked/called with arguments. A
single lambda can be passed to a function”
	 $a = [1,2,3]
	 each($a) |value| {notice $value }
Lambdas and functions
each - iterating over an array
map - transform an array or hash into a new array
filter - filters an array or hash
reduce - reduces an array or hash to a single value
slice - slices an array or hash into chunks
Using functions
Standard Puppet way:
function_name(argument) - each($variable)
Ruby way - chaining
argument.function_name - $variable.each
EPP Template engine
Use Puppet $var instead of Ruby @var
epp(filename)
inline_epp(epp_string)
HEREDOC support
Like Shell HEREDOC
$multiline_text = @(EOF)
# Managed by Puppet
intended two spaces
starting at beginning of line
| intention starts at pipe sign
EOF
HEREDOC control character
- prevents a new line (like erb/epp)
@(“EOF”) - variable substition
@(EOF/tn) - enables char escapes
availabe char escapes: t,s,r,n,u,L,$
Default to off
HEREDOC syntax check
@(EOF:json)
Can be used by e.g. Gepetto or any other Puppet
plugin
Built in : json
$var = @(EOF:json)
{
“Puppet”: ‘awesome’
}
- EOF
Types, Types, Types
Why do we need types?
class ssh (
	 $server = true,
) {
	 if $server {
	 	 include ssh::server
	 }
}
Parameterized class with parameter default
Why do we need types?
class ssh (
	 $server = true,
) {
	 if $server {
	 	 include ssh::server
	 }
}
!
!
class { ‘ssh’:
	 server => ‘false’,
}
!
!
!
!
!
!
!
!
!
Usage of parameterised class. But: string
instead of boolean !
Why do we need types?
class ssh (
	 $server = true,
) {
	 if validate_bool($server) {
	 	 include ssh::server
	 }
}
!
!
class { ‘ssh’:
	 server => ‘false’,
}
Parameterized class with parameter default
!
!
Now with data validation (from stdlib)
Why do we need types?
users::hash:
‘tom’:
gid: ‘123’
home: ‘/home/tom’
managehome: false
‘ben’:
gid: ‘124’
home: /home/ben
managehome: ‘true’
‘tim’:
gid: 0125
home: ‘home/tim’
managehome: ‘false’
But: how to deal with more complex data?
!
!
!
!
!
!
Missing quotes
String instead of bool
!
Missing quotes and leading 0
Missing trailing slash
String instead of bool
We need types!
class ssh (
	 Boolean $server = true,
) {
	 if $server {
	 	 include ssh::server
	 }
}
!
Types, Types, Types, Types
We need types!
class ssh (
	 Boolean $server = true,
) {
	 if $server {
	 	 include ssh::server
	 }
}
!
!
class { ‘ssh’:
	 server => ‘false’,
}
!
Error 400 on SERVER: Expected parameter 'server' of
'Class[Ssh]' to have type Boolean, got String
!
!
!
!
!
!
!
!
!
We now get proper error messages.
We want types!
class users (
Hash $hash
) {
$userarray = keys($hash)
users::user_data { $userarray: }
}
!
define users::user_data (
String $gid = $users::hash[$title][gid],
String $home = $users::hash[$title][home],
Boolean $managehome = $users::hash[$title][managehome],
) {
}
Available Types
Integer[from, to]
Float[from,to]
Enum[*strings]
Pattern[*patterns]
Regexp[regexp]
Boolean
Array
Hash
Deprecations
Deprecations
Node inheritance
Empty string comparison
Variable naming
Reference syntax
Hyphens in names
Ruby DSL
Node Inheritance
node ‘basenode’ {
include base
include security
}
!
node ‘www.server.com’ inherits basenode {
include webserver
}
# Dummy node as default
!
!
!
!
# Real node inherits from basenode
Roles & Profiles
node ‘www.server.com’ {
include webserver
}
!
!
class basenode {
include base
include security
}
!
class webserver {
include basenode
}
# No more node inheritance
!
!
!
!
# Define a class instead
Empty string comparison
An empty string compares to true instead of false
Empty string comparison
$message = ‘’
!
if $message {
notify { “Message: ${message}”: }
}
Empty string set as default
!
Check for variable existing and having
content
String comparison
$ message = ‘’
!
if $message and $message != ‘’ {
notify { “Message: ${message}”: }
}
Empty string set as default
!
Check for variable existing and not empty
string
Variable naming
A variable may not start with
a capital letter
an underscore
Reference syntax
Reference deprecation
capital letter on title
empty space between Type reference and title
!
Class [Ssh]
!
Class [‘ssh’]
!
Class[‘ssh’]
!
Deprecated capital title
!
Empty space
!
Working
Hyphens in names
No more hyphens in
module name
class name
define name
Hyphens in names
!
<modulepath>/syslog-ng/
!
<modulepath>/syslog_ng
!
class syslog-ng { … }
!
class syslog_ng { … }
!
Deprecated
!
New name required
!
Deprecated
!
New name required (obious -> module/
class naming convention)
Ruby DSL
Puppet Ticket #18876
Closed 02/04/2013
New Ruby DSL API was revamped: “the number and
severity of issues that came up in exploratory testing
led us to the conclusion that it was not supportable
code” - Puppet Dev ML - 01/26/2013
	 	 hostclass ‘ssh’ do
	 	 end
More deprecation
Relative resolution of class names - the reason why
you want to use double colon - include ::ssh
Importing manifests
Matching numbers with regexp
Search function
Mutating arrays and hashes
The 4 Powers of Puppet 4
Performance
Request response times and catalog compile times
!
!
Scalability
Switch on/off functionality for multi master setup
!
!
!
Measurability
Flexibility
Dealing with complex data natively in Puppet DSL
Upgrading to Puppet 4
Breaks old style Puppet
DSL code
Read documentation
carefully
Run tests
More information
https://docs.puppetlabs.com/puppet/3.7/reference/
deprecated_language.html
http://puppet-on-the-edge.blogspot.de/
https://github.com/puppetlabs/puppet-specifications
Text
Support your modules
Write PR, file bug reports, fix issues
Thank you
Martin Alfke
!
Co-Founder & CEO
example42 GmbH i.G.

More Related Content

PDF
Power of Puppet 4
PPTX
Enjoying the Journey from Puppet 3.x to Puppet 4.x (PuppetConf 2016)
PDF
Doing It Wrong with Puppet -
PDF
Can you upgrade to Puppet 4.x? (Beginner) Can you upgrade to Puppet 4.x? (Beg...
PPTX
Migrating to Puppet 4.0
PDF
Puppet Camp Paris 2015: Power of Puppet 4 (Beginner)
PDF
Loops and Unicorns - The Future of the Puppet Language - PuppetConf 2013
PDF
Can you upgrade to Puppet 4.x?
Power of Puppet 4
Enjoying the Journey from Puppet 3.x to Puppet 4.x (PuppetConf 2016)
Doing It Wrong with Puppet -
Can you upgrade to Puppet 4.x? (Beginner) Can you upgrade to Puppet 4.x? (Beg...
Migrating to Puppet 4.0
Puppet Camp Paris 2015: Power of Puppet 4 (Beginner)
Loops and Unicorns - The Future of the Puppet Language - PuppetConf 2013
Can you upgrade to Puppet 4.x?

What's hot (19)

PDF
Anatomy of a reusable module
PDF
BSDM with BASH: Command Interpolation
PDF
Replacing "exec" with a type and provider: Return manifests to a declarative ...
PDF
Object Trampoline: Why having not the object you want is what you need.
PDF
Puppet Camp Berlin 2015: Martin Alfke | The Power of Puppet 4
PDF
Puppet Camp Paris 2016 Data in Modules
PDF
Puppet @ Seat
PDF
Metadata-driven Testing
PDF
Doing the Refactor Dance - Making Your Puppet Modules More Modular - PuppetCo...
PDF
The $path to knowledge: What little it take to unit-test Perl.
PDF
Findbin libs
PDF
Smoking docker
PDF
Hypers and Gathers and Takes! Oh my!
PDF
Yapc::NA::2009 - Command Line Perl
PDF
Spl in the wild
PDF
Puppet modules: An Holistic Approach
PDF
PHP 8.1 - What's new and changed
ODP
Advanced Perl Techniques
Anatomy of a reusable module
BSDM with BASH: Command Interpolation
Replacing "exec" with a type and provider: Return manifests to a declarative ...
Object Trampoline: Why having not the object you want is what you need.
Puppet Camp Berlin 2015: Martin Alfke | The Power of Puppet 4
Puppet Camp Paris 2016 Data in Modules
Puppet @ Seat
Metadata-driven Testing
Doing the Refactor Dance - Making Your Puppet Modules More Modular - PuppetCo...
The $path to knowledge: What little it take to unit-test Perl.
Findbin libs
Smoking docker
Hypers and Gathers and Takes! Oh my!
Yapc::NA::2009 - Command Line Perl
Spl in the wild
Puppet modules: An Holistic Approach
PHP 8.1 - What's new and changed
Advanced Perl Techniques
Ad

Similar to Puppet Camp Amsterdam 2015: The Power of Puppet 4 (Beginner) (20)

PDF
Puppet Camp Berlin 2015: The Power of Puppet 4
ODP
Introduction to Modern Perl
ODP
Mastering Namespaces in PHP
PPTX
PHP Powerpoint -- Teach PHP with this
PDF
Puppet Camp Duesseldorf 2014: Martin Alfke - Can you upgrade to puppet 4.x?
PDF
Perl 5.10
ODP
What's new, what's hot in PHP 5.3
ODP
Advanced Perl Techniques
PDF
Was können wir von Rebol lernen?
PPT
Apache Velocity
PPT
Os Bubna
PPT
Apache Velocity
PPT
Training on php by cyber security infotech (csi)
PPTX
First steps in C-Shell
PDF
Refactor Dance - Puppet Labs 'Best Practices'
ODP
What's new in Perl 5.10?
PDF
Exploring Ceylon with Gavin King - JUG BB Talk - Belrin 2014
PDF
Replacing Oracle with MongoDB for a templating application at the Bavarian go...
PPT
Plunging Into Perl While Avoiding the Deep End (mostly)
PPTX
Quick beginner to Lower-Advanced guide/tutorial in PHP
Puppet Camp Berlin 2015: The Power of Puppet 4
Introduction to Modern Perl
Mastering Namespaces in PHP
PHP Powerpoint -- Teach PHP with this
Puppet Camp Duesseldorf 2014: Martin Alfke - Can you upgrade to puppet 4.x?
Perl 5.10
What's new, what's hot in PHP 5.3
Advanced Perl Techniques
Was können wir von Rebol lernen?
Apache Velocity
Os Bubna
Apache Velocity
Training on php by cyber security infotech (csi)
First steps in C-Shell
Refactor Dance - Puppet Labs 'Best Practices'
What's new in Perl 5.10?
Exploring Ceylon with Gavin King - JUG BB Talk - Belrin 2014
Replacing Oracle with MongoDB for a templating application at the Bavarian go...
Plunging Into Perl While Avoiding the Deep End (mostly)
Quick beginner to Lower-Advanced guide/tutorial in PHP
Ad

More from Puppet (20)

PPTX
Puppet Community Day: Planning the Future Together
PPTX
The Evolution of Puppet: Key Changes and Modernization Tips
PPTX
Can You Help Me Upgrade to Puppet 8? Tips, Tools & Best Practices for Your Up...
PPTX
Bolt Dynamic Inventory: Making Puppet Easier
PPTX
Customizing Reporting with the Puppet Report Processor
PPTX
Puppet at ConfigMgmtCamp 2025 Sponsor Deck
PPTX
The State of Puppet in 2025: A Presentation from Developer Relations Lead Dav...
PPTX
Let Red be Red and Green be Green: The Automated Workflow Restarter in GitHub...
PDF
Puppet camp2021 testing modules and controlrepo
PPTX
Puppetcamp r10kyaml
PDF
2021 04-15 operational verification (with notes)
PPTX
Puppet camp vscode
PDF
Modules of the twenties
PDF
Applying Roles and Profiles method to compliance code
PPTX
KGI compliance as-code approach
PDF
Enforce compliance policy with model-driven automation
PDF
Keynote: Puppet camp compliance
PPTX
Automating it management with Puppet + ServiceNow
PPTX
Puppet: The best way to harden Windows
PPTX
Simplified Patch Management with Puppet - Oct. 2020
Puppet Community Day: Planning the Future Together
The Evolution of Puppet: Key Changes and Modernization Tips
Can You Help Me Upgrade to Puppet 8? Tips, Tools & Best Practices for Your Up...
Bolt Dynamic Inventory: Making Puppet Easier
Customizing Reporting with the Puppet Report Processor
Puppet at ConfigMgmtCamp 2025 Sponsor Deck
The State of Puppet in 2025: A Presentation from Developer Relations Lead Dav...
Let Red be Red and Green be Green: The Automated Workflow Restarter in GitHub...
Puppet camp2021 testing modules and controlrepo
Puppetcamp r10kyaml
2021 04-15 operational verification (with notes)
Puppet camp vscode
Modules of the twenties
Applying Roles and Profiles method to compliance code
KGI compliance as-code approach
Enforce compliance policy with model-driven automation
Keynote: Puppet camp compliance
Automating it management with Puppet + ServiceNow
Puppet: The best way to harden Windows
Simplified Patch Management with Puppet - Oct. 2020

Recently uploaded (20)

PDF
top salesforce developer skills in 2025.pdf
PPTX
Operating system designcfffgfgggggggvggggggggg
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PPTX
Introduction to Artificial Intelligence
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
PPTX
Odoo POS Development Services by CandidRoot Solutions
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PDF
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
PDF
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
PDF
Cost to Outsource Software Development in 2025
PDF
System and Network Administraation Chapter 3
PDF
Nekopoi APK 2025 free lastest update
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PDF
Digital Strategies for Manufacturing Companies
PPTX
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
PDF
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
PPTX
Reimagine Home Health with the Power of Agentic AI​
PPTX
Transform Your Business with a Software ERP System
PDF
System and Network Administration Chapter 2
top salesforce developer skills in 2025.pdf
Operating system designcfffgfgggggggvggggggggg
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
Introduction to Artificial Intelligence
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
Odoo POS Development Services by CandidRoot Solutions
Adobe Illustrator 28.6 Crack My Vision of Vector Design
Navsoft: AI-Powered Business Solutions & Custom Software Development
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
Cost to Outsource Software Development in 2025
System and Network Administraation Chapter 3
Nekopoi APK 2025 free lastest update
Upgrade and Innovation Strategies for SAP ERP Customers
Digital Strategies for Manufacturing Companies
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
Reimagine Home Health with the Power of Agentic AI​
Transform Your Business with a Software ERP System
System and Network Administration Chapter 2

Puppet Camp Amsterdam 2015: The Power of Puppet 4 (Beginner)