SlideShare une entreprise Scribd logo
1  sur  43
Télécharger pour lire hors ligne
Can you upgrade to 
Puppet 4.x? 
PuppetCamp London 
Martin Alfke 
<martin.alfke@buero20.org>
Agenda 
• Why upgrading at all? 
• Is your code still working? 
• How to upgrading Puppet? 
• What brings Puppet 4?
About me 
• Martin Alfke 
• Berlin/Germany 
• Freelancer / Trainer 
• PuppetLabs Training Partner 
• Puppet User Group Berlin
Poll 
! 
! 
• Using Puppet 2.x?
Poll 
! 
! 
• Using Puppet 2.x? 
• Using Puppet 3.x?
Why do I need to bother? 
• Fast releases 
• Best Practices 
• Changing functionality 
• Removing deprecated stuff 
• Puppet 4 is coming
Why should I upgrade 
Puppet at all? 
• Do you want security updates? 
• Do you want to make use of new functionality? 
(e.g. automatic data bindings, environmentpath, 
future parser) 
• Do you want to get support (community or 
enterprise)?
Is my Puppet DSL code still 
working on new versions? 
• Your code was developed some years 
ago and is still running unmodified 
• Your code was written on old best 
practices and does not follow new 
style guide 
• You do not check your Puppet runs 
for deprecation warnings (or do 
you?)
What to look for?
BAD 
Best practice 
• Do you inherit from inherited 
classes? 
• Do you still use import? 
• Do you modify remote modules? 
• Do you access non-local variables 
without scope names?
BAD 
Best practice 
Stop doing multiple levels of inheritance 
! 
class foo { 
} 
! 
class foo::bar inherits foo { 
} 
! 
class foo::baz inherits foo::bar { 
} 
! 
class foo::foobar inherits foo::baz { 
}
BAD 
Best practice 
Stop doing inheritance 
! 
class foo { 
} 
! 
class foo::bar inherits foo { 
} 
! 
class foo::baz inherits foo { 
} 
! 
class foo::foobar inherits foo { 
}
Best practice 
Restrict Inheritance 
! 
In most cases you can use parameterised classes instead. 
Only one kind of inheritance is proven good practice: inherit from 
module params.pp 
! 
class ssh ( 
$server = $ssh::params::server, 
$client = $ssh::params::client, 
$x11fwd = false, 
) inherits ssh::params { 
} 
! 
class { ::ssh::params:: 
server => false, 
x11fwd => true, 
} 
BETTER
BAD 
Best practice 
Stop importing 
! 
# ssh/manifests/init.pp 
class ssh { 
import ‘server.pp’ 
} 
! 
# ssh/manifests/server.pp 
class ssh::secure { 
} 
! 
# ssh/manifests/secure.pp 
class ssh::secure { 
} 
! 
Which class ssh::secure will be used?
Best practice 
Use include 
! 
In most cases you can make use of the puppet autoloader and 
you can use include. 
! 
# ssh/manifests/init.pp 
class ssh { 
include ::ssh::server 
} 
BETTER 
! 
# ssh/manifests/server.pp 
class ssh::server { 
} 
!
BAD 
Best practice 
Stop modifying remote modules 
! 
Take “remote modules” as a software 
provided by others. 
Are you also patching apache?
Best practice 
Co-Work on remote 
modules 
! 
Do a PR if you want 
improvements. 
! 
Keep your remote modules 
upgradeable. 
BETTER
BAD 
Best practice 
Stop using non-local variables 
without scope 
! 
class ssh ( 
$server = ‘baz’ 
) { 
} 
! 
class ssh::server { 
notify { $server: } 
}
Best practice 
Start using non-local variables with 
scope 
! 
class ssh ( 
$server = true 
) { 
} 
! 
class ssh::server { 
notify { $ssh::server: } 
} 
BETTER
BAD 
Best practice 
Stop using un-scoped variables 
in templates 
!! 
key = <%= server %> 
! 
! 
!
Best practice 
Start using scoped variables in 
templates 
!! 
BETTER 
key = <%= @server %> 
! 
or 
! 
key = <%= scope.lookupvar(‘ssh::server’) %> 
! 
or 
! 
key = <%= scope[‘ssh::server’]
BAD 
Best practice 
Stop using factor variables without top-scope 
! 
class ssh { 
notify { “We are on OS: $operatingsystem”: } 
} 
! 
class ssh::server { 
if $is_virtual { 
notify { “We are running on $virtual virtualisation”: } 
} else { 
notify { “We are running on hardware: $productname”: } 
}
Best practice 
Start using factor variables with top-scope 
! 
class ssh { 
notify { “We are on OS: ${::operatingsystem}”: } 
} 
! 
class ssh::server { 
if $::is_virtual { 
notify { “We are running on ${::virtual} virtualisation”: } 
} else { 
notify { “We are running on hardware: ${::productname}”: } 
} 
BETTER
BAD 
Best practice 
Stop not doing data validation 
! 
class ssh ( 
$server = hiera(‘server’, ‘localhost’) 
){ 
notify { “We will use Server: ${server}”: } 
} 
!
Best practice 
BETTER 
Start doing data validation 
! 
class ssh ( 
$server = hiera(‘server’, ‘localhost’) 
){ 
# validate_string is a function from stdlib 
validate_string($server) 
notify { “We will use Server: ${server}”: } 
} 
!
Remote modules 
• Do foreign modules support 
your version? 
• Newer Puppet versions have 
new function attributes (arity) 
• New foreign module versions 
might need newer modules 
not supported by your 
Puppet version
Remote modules 
• Check Puppetfile / 
metadata.json for 
requirements 
• Test prior upgrading in 
production
How can I test my actual 
Puppet DSL code?
How can I test my actual 
Puppet DSL code? 
• Syntax/Semantic check 
• puppet parser validate / puppet-syntax / puppet-lint 
• Unit test 
• rspec-puppet 
• Integration test 
• beaker, vagrant, serverspec,…
Simple rspec upgrade check
Simple rspec upgrade check 
• Add rspec tests to all your modules and run them 
locally 
• Use rvm or rbenv to choose between ruby 
versions 
• Provide puppet version to verify in Gemfile 
• Run spec tests locally and verify results
Automatic rspec upgrade 
check
Automatic rspec upgrade 
check 
• Install a CI-Server (Jenkins, 
GO, Teamcity,…) and add build 
steps 
• Add git commit hooks to 
identify changes in 
repositories 
• Run rspec tests automatically
Simple Puppet upgrade test
Simple Puppet upgrade test 
• Install Puppet tarball in a separate directory on 
your master 
• Start puppet master manually using RUBYLIB or 
ruby -I on another port (—masterport 8141) 
• Test run from a single node with —noop against 
the new port
Simple Puppet upgrade test 
Example: additional Puppet Master process: 
! 
tar zxf puppet-3.7.1.tar.gz -C /opt/puppet-3.7.1 
! 
ruby1.8 -I /opt/puppet-3.7.1/lib /opt/puppet-3.7.1/bin/puppet master  
—nodaemonize —masterport=8150 —pidfile=/tmp/puppetmaster.pid 
!! 
Example: Agent run against additional Puppet Master process: 
! 
puppet agent —test —masterport 8150
Demo
Puppet 4 
• Major update 
• Removes deprecated 
functionality 
• New language features
Puppet 4 
• Deprecated in Puppet 4: 
• node inheritance - use roles/profiles instead 
• upper case variable names 
• variable with underscore in first position 
• references to classes using upper case name/title 
• hypens and periods in names 
• Ruby DSL
Puppet 4 
• New in Puppet 4: 
• Strict variable naming and lookup (will become 
mandatory in Puppet 5) 
• Variable type validation 
• Boolean conversion (“” -> true instead of false) 
• Environmentpath 
• Functions in Puppet 
• New function API
Puppet 4 
• Further reading 
• https://github.com/puppetlabs/puppet-specifications 
• http://puppet-on-the-edge.blogspot.co.uk/
Can you upgrade to Puppet 4.x?
You can upgrade to 
Puppet 4.x! 
! 
Thank you. 
! 
Martin Alfke 
<martin.alfke@buero20.org>

Contenu connexe

Tendances

Doing It Wrong with Puppet -
Doing It Wrong with Puppet - Doing It Wrong with Puppet -
Doing It Wrong with Puppet - Puppet
 
Puppet control-repo 
to the next level
Puppet control-repo 
to the next levelPuppet control-repo 
to the next level
Puppet control-repo 
to the next levelAlessandro Franceschi
 
Developing IT infrastructures with Puppet
Developing IT infrastructures with PuppetDeveloping IT infrastructures with Puppet
Developing IT infrastructures with PuppetAlessandro Franceschi
 
Puppet Continuous Integration with PE and GitLab
Puppet Continuous Integration with PE and GitLabPuppet Continuous Integration with PE and GitLab
Puppet Continuous Integration with PE and GitLabAlessandro Franceschi
 
Enjoying the Journey from Puppet 3.x to Puppet 4.x (PuppetConf 2016)
Enjoying the Journey from Puppet 3.x to Puppet 4.x (PuppetConf 2016)Enjoying the Journey from Puppet 3.x to Puppet 4.x (PuppetConf 2016)
Enjoying the Journey from Puppet 3.x to Puppet 4.x (PuppetConf 2016)Robert Nelson
 
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
 
Puppet Camp Paris 2016 Data in Modules
Puppet Camp Paris 2016 Data in ModulesPuppet Camp Paris 2016 Data in Modules
Puppet Camp Paris 2016 Data in ModulesMartin Alfke
 
Test-Driven Puppet Development - PuppetConf 2014
Test-Driven Puppet Development - PuppetConf 2014Test-Driven Puppet Development - PuppetConf 2014
Test-Driven Puppet Development - PuppetConf 2014Puppet
 
Puppet loves RSpec, why you should, too
Puppet loves RSpec, why you should, tooPuppet loves RSpec, why you should, too
Puppet loves RSpec, why you should, tooDennis Rowe
 
Puppet modules: An Holistic Approach
Puppet modules: An Holistic ApproachPuppet modules: An Holistic Approach
Puppet modules: An Holistic ApproachAlessandro Franceschi
 
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
 
Creating a mature puppet system
Creating a mature puppet systemCreating a mature puppet system
Creating a mature puppet systemrkhatibi
 
Learning puppet chapter 2
Learning puppet chapter 2Learning puppet chapter 2
Learning puppet chapter 2Vishal Biyani
 
What you need to remember when you upload to CPAN
What you need to remember when you upload to CPANWhat you need to remember when you upload to CPAN
What you need to remember when you upload to CPANcharsbar
 
Puppet for dummies - ZendCon 2011 Edition
Puppet for dummies - ZendCon 2011 EditionPuppet for dummies - ZendCon 2011 Edition
Puppet for dummies - ZendCon 2011 EditionJoshua Thijssen
 

Tendances (20)

Puppet: From 0 to 100 in 30 minutes
Puppet: From 0 to 100 in 30 minutesPuppet: From 0 to 100 in 30 minutes
Puppet: From 0 to 100 in 30 minutes
 
Doing It Wrong with Puppet -
Doing It Wrong with Puppet - Doing It Wrong with Puppet -
Doing It Wrong with Puppet -
 
Puppet control-repo 
to the next level
Puppet control-repo 
to the next levelPuppet control-repo 
to the next level
Puppet control-repo 
to the next level
 
Developing IT infrastructures with Puppet
Developing IT infrastructures with PuppetDeveloping IT infrastructures with Puppet
Developing IT infrastructures with Puppet
 
Puppet Continuous Integration with PE and GitLab
Puppet Continuous Integration with PE and GitLabPuppet Continuous Integration with PE and GitLab
Puppet Continuous Integration with PE and GitLab
 
Enjoying the Journey from Puppet 3.x to Puppet 4.x (PuppetConf 2016)
Enjoying the Journey from Puppet 3.x to Puppet 4.x (PuppetConf 2016)Enjoying the Journey from Puppet 3.x to Puppet 4.x (PuppetConf 2016)
Enjoying the Journey from Puppet 3.x to Puppet 4.x (PuppetConf 2016)
 
Intro to-puppet
Intro to-puppetIntro to-puppet
Intro to-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 Camp Paris 2016 Data in Modules
Puppet Camp Paris 2016 Data in ModulesPuppet Camp Paris 2016 Data in Modules
Puppet Camp Paris 2016 Data in Modules
 
Test-Driven Puppet Development - PuppetConf 2014
Test-Driven Puppet Development - PuppetConf 2014Test-Driven Puppet Development - PuppetConf 2014
Test-Driven Puppet Development - PuppetConf 2014
 
Puppet loves RSpec, why you should, too
Puppet loves RSpec, why you should, tooPuppet loves RSpec, why you should, too
Puppet loves RSpec, why you should, too
 
Puppet modules: An Holistic Approach
Puppet modules: An Holistic ApproachPuppet modules: An Holistic Approach
Puppet modules: An Holistic Approach
 
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...
 
Unit Testing Lots of Perl
Unit Testing Lots of PerlUnit Testing Lots of Perl
Unit Testing Lots of Perl
 
Creating a mature puppet system
Creating a mature puppet systemCreating a mature puppet system
Creating a mature puppet system
 
Learning puppet chapter 2
Learning puppet chapter 2Learning puppet chapter 2
Learning puppet chapter 2
 
What you need to remember when you upload to CPAN
What you need to remember when you upload to CPANWhat you need to remember when you upload to CPAN
What you need to remember when you upload to CPAN
 
Power of Puppet 4
Power of Puppet 4Power of Puppet 4
Power of Puppet 4
 
Troubleshooting Puppet
Troubleshooting PuppetTroubleshooting Puppet
Troubleshooting Puppet
 
Puppet for dummies - ZendCon 2011 Edition
Puppet for dummies - ZendCon 2011 EditionPuppet for dummies - ZendCon 2011 Edition
Puppet for dummies - ZendCon 2011 Edition
 

En vedette

Upgrading Puppet CommitterConf Essen 2014
Upgrading Puppet CommitterConf Essen 2014Upgrading Puppet CommitterConf Essen 2014
Upgrading Puppet CommitterConf Essen 2014Martin Alfke
 
GUUG Hamburg OpenNebula
GUUG Hamburg OpenNebulaGUUG Hamburg OpenNebula
GUUG Hamburg OpenNebulaMartin Alfke
 
Puppet camp london-modulerewritingsmartway
Puppet camp london-modulerewritingsmartwayPuppet camp london-modulerewritingsmartway
Puppet camp london-modulerewritingsmartwayMartin Alfke
 
PuppetConf 2016 Moving from Exec to Types and Provides
PuppetConf 2016 Moving from Exec to Types and ProvidesPuppetConf 2016 Moving from Exec to Types and Provides
PuppetConf 2016 Moving from Exec to Types and ProvidesMartin Alfke
 
Gluster fs buero20_presentation
Gluster fs buero20_presentationGluster fs buero20_presentation
Gluster fs buero20_presentationMartin Alfke
 

En vedette (6)

Upgrading Puppet CommitterConf Essen 2014
Upgrading Puppet CommitterConf Essen 2014Upgrading Puppet CommitterConf Essen 2014
Upgrading Puppet CommitterConf Essen 2014
 
One
OneOne
One
 
GUUG Hamburg OpenNebula
GUUG Hamburg OpenNebulaGUUG Hamburg OpenNebula
GUUG Hamburg OpenNebula
 
Puppet camp london-modulerewritingsmartway
Puppet camp london-modulerewritingsmartwayPuppet camp london-modulerewritingsmartway
Puppet camp london-modulerewritingsmartway
 
PuppetConf 2016 Moving from Exec to Types and Provides
PuppetConf 2016 Moving from Exec to Types and ProvidesPuppetConf 2016 Moving from Exec to Types and Provides
PuppetConf 2016 Moving from Exec to Types and Provides
 
Gluster fs buero20_presentation
Gluster fs buero20_presentationGluster fs buero20_presentation
Gluster fs buero20_presentation
 

Similaire à Can you upgrade to Puppet 4.x?

Puppet Camp Duesseldorf 2014: Martin Alfke - Can you upgrade to puppet 4.x?
Puppet Camp Duesseldorf 2014: Martin Alfke - Can you upgrade to puppet 4.x?Puppet Camp Duesseldorf 2014: Martin Alfke - Can you upgrade to puppet 4.x?
Puppet Camp Duesseldorf 2014: Martin Alfke - Can you upgrade to puppet 4.x?NETWAYS
 
PuppetConf 2016: Enjoying the Journey from Puppet 3.x to 4.x – Rob Nelson, AT&T
PuppetConf 2016: Enjoying the Journey from Puppet 3.x to 4.x – Rob Nelson, AT&T PuppetConf 2016: Enjoying the Journey from Puppet 3.x to 4.x – Rob Nelson, AT&T
PuppetConf 2016: Enjoying the Journey from Puppet 3.x to 4.x – Rob Nelson, AT&T Puppet
 
Puppet getting started by Dirk Götz
Puppet getting started by Dirk GötzPuppet getting started by Dirk Götz
Puppet getting started by Dirk GötzNETWAYS
 
Strategies for Puppet code upgrade and refactoring
Strategies for Puppet code upgrade and refactoringStrategies for Puppet code upgrade and refactoring
Strategies for Puppet code upgrade and refactoringAlessandro Franceschi
 
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
 
Puppet Camp Paris 2014: Test Driven Development
Puppet Camp Paris 2014: Test Driven DevelopmentPuppet Camp Paris 2014: Test Driven Development
Puppet Camp Paris 2014: Test Driven DevelopmentPuppet
 
20140408 tdd puppetcamp-paris
20140408 tdd puppetcamp-paris20140408 tdd puppetcamp-paris
20140408 tdd puppetcamp-parisJohan De Wit
 
Puppet Camp Paris 2015: Power of Puppet 4 (Beginner)
Puppet Camp Paris 2015: Power of Puppet 4 (Beginner) Puppet Camp Paris 2015: Power of Puppet 4 (Beginner)
Puppet Camp Paris 2015: Power of Puppet 4 (Beginner) Puppet
 
Loops and Unicorns - The Future of the Puppet Language - PuppetConf 2013
Loops and Unicorns - The Future of the Puppet Language - PuppetConf 2013Loops and Unicorns - The Future of the Puppet Language - PuppetConf 2013
Loops and Unicorns - The Future of the Puppet Language - PuppetConf 2013Puppet
 
Scaling to-5000-nodes
Scaling to-5000-nodesScaling to-5000-nodes
Scaling to-5000-nodesPhilip Watts
 
Puppet Camp New York 2015: Puppet Enterprise Scaling Lessons Learned (Interme...
Puppet Camp New York 2015: Puppet Enterprise Scaling Lessons Learned (Interme...Puppet Camp New York 2015: Puppet Enterprise Scaling Lessons Learned (Interme...
Puppet Camp New York 2015: Puppet Enterprise Scaling Lessons Learned (Interme...Puppet
 
From SaltStack to Puppet and beyond...
From SaltStack to Puppet and beyond...From SaltStack to Puppet and beyond...
From SaltStack to Puppet and beyond...Yury Bushmelev
 
Bootstrapping Puppet and Application Deployment - PuppetConf 2013
Bootstrapping Puppet and Application Deployment - PuppetConf 2013Bootstrapping Puppet and Application Deployment - PuppetConf 2013
Bootstrapping Puppet and Application Deployment - PuppetConf 2013Puppet
 
Chef Fundamentals Training Series Module 3: Setting up Nodes and Cookbook Aut...
Chef Fundamentals Training Series Module 3: Setting up Nodes and Cookbook Aut...Chef Fundamentals Training Series Module 3: Setting up Nodes and Cookbook Aut...
Chef Fundamentals Training Series Module 3: Setting up Nodes and Cookbook Aut...Chef Software, Inc.
 
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
 
Puppet Camp Berlin 2015: The Power of Puppet 4
Puppet Camp Berlin 2015: The Power of Puppet 4Puppet Camp Berlin 2015: The Power of Puppet 4
Puppet Camp Berlin 2015: The Power of Puppet 4Puppet
 
Testing for Ops: Going Beyond the Manifest - PuppetConf 2013
Testing for Ops: Going Beyond the Manifest - PuppetConf 2013Testing for Ops: Going Beyond the Manifest - PuppetConf 2013
Testing for Ops: Going Beyond the Manifest - PuppetConf 2013Puppet
 
The Grand Puppet Sub-Systems Tour - Nicholas Fagerlund, Puppet Labs
The Grand Puppet Sub-Systems Tour - Nicholas Fagerlund, Puppet LabsThe Grand Puppet Sub-Systems Tour - Nicholas Fagerlund, Puppet Labs
The Grand Puppet Sub-Systems Tour - Nicholas Fagerlund, Puppet LabsPuppet
 
Puppet Development Workflow
Puppet Development WorkflowPuppet Development Workflow
Puppet Development WorkflowJeffery Smith
 

Similaire à Can you upgrade to Puppet 4.x? (20)

Puppet Camp Duesseldorf 2014: Martin Alfke - Can you upgrade to puppet 4.x?
Puppet Camp Duesseldorf 2014: Martin Alfke - Can you upgrade to puppet 4.x?Puppet Camp Duesseldorf 2014: Martin Alfke - Can you upgrade to puppet 4.x?
Puppet Camp Duesseldorf 2014: Martin Alfke - Can you upgrade to puppet 4.x?
 
PuppetConf 2016: Enjoying the Journey from Puppet 3.x to 4.x – Rob Nelson, AT&T
PuppetConf 2016: Enjoying the Journey from Puppet 3.x to 4.x – Rob Nelson, AT&T PuppetConf 2016: Enjoying the Journey from Puppet 3.x to 4.x – Rob Nelson, AT&T
PuppetConf 2016: Enjoying the Journey from Puppet 3.x to 4.x – Rob Nelson, AT&T
 
Puppet getting started by Dirk Götz
Puppet getting started by Dirk GötzPuppet getting started by Dirk Götz
Puppet getting started by Dirk Götz
 
Strategies for Puppet code upgrade and refactoring
Strategies for Puppet code upgrade and refactoringStrategies for Puppet code upgrade and refactoring
Strategies for Puppet code upgrade and refactoring
 
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
 
Puppet Camp Paris 2014: Test Driven Development
Puppet Camp Paris 2014: Test Driven DevelopmentPuppet Camp Paris 2014: Test Driven Development
Puppet Camp Paris 2014: Test Driven Development
 
20140408 tdd puppetcamp-paris
20140408 tdd puppetcamp-paris20140408 tdd puppetcamp-paris
20140408 tdd puppetcamp-paris
 
Puppet Camp Paris 2015: Power of Puppet 4 (Beginner)
Puppet Camp Paris 2015: Power of Puppet 4 (Beginner) Puppet Camp Paris 2015: Power of Puppet 4 (Beginner)
Puppet Camp Paris 2015: Power of Puppet 4 (Beginner)
 
Puppet
PuppetPuppet
Puppet
 
Loops and Unicorns - The Future of the Puppet Language - PuppetConf 2013
Loops and Unicorns - The Future of the Puppet Language - PuppetConf 2013Loops and Unicorns - The Future of the Puppet Language - PuppetConf 2013
Loops and Unicorns - The Future of the Puppet Language - PuppetConf 2013
 
Scaling to-5000-nodes
Scaling to-5000-nodesScaling to-5000-nodes
Scaling to-5000-nodes
 
Puppet Camp New York 2015: Puppet Enterprise Scaling Lessons Learned (Interme...
Puppet Camp New York 2015: Puppet Enterprise Scaling Lessons Learned (Interme...Puppet Camp New York 2015: Puppet Enterprise Scaling Lessons Learned (Interme...
Puppet Camp New York 2015: Puppet Enterprise Scaling Lessons Learned (Interme...
 
From SaltStack to Puppet and beyond...
From SaltStack to Puppet and beyond...From SaltStack to Puppet and beyond...
From SaltStack to Puppet and beyond...
 
Bootstrapping Puppet and Application Deployment - PuppetConf 2013
Bootstrapping Puppet and Application Deployment - PuppetConf 2013Bootstrapping Puppet and Application Deployment - PuppetConf 2013
Bootstrapping Puppet and Application Deployment - PuppetConf 2013
 
Chef Fundamentals Training Series Module 3: Setting up Nodes and Cookbook Aut...
Chef Fundamentals Training Series Module 3: Setting up Nodes and Cookbook Aut...Chef Fundamentals Training Series Module 3: Setting up Nodes and Cookbook Aut...
Chef Fundamentals Training Series Module 3: Setting up Nodes and Cookbook Aut...
 
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
 
Puppet Camp Berlin 2015: The Power of Puppet 4
Puppet Camp Berlin 2015: The Power of Puppet 4Puppet Camp Berlin 2015: The Power of Puppet 4
Puppet Camp Berlin 2015: The Power of Puppet 4
 
Testing for Ops: Going Beyond the Manifest - PuppetConf 2013
Testing for Ops: Going Beyond the Manifest - PuppetConf 2013Testing for Ops: Going Beyond the Manifest - PuppetConf 2013
Testing for Ops: Going Beyond the Manifest - PuppetConf 2013
 
The Grand Puppet Sub-Systems Tour - Nicholas Fagerlund, Puppet Labs
The Grand Puppet Sub-Systems Tour - Nicholas Fagerlund, Puppet LabsThe Grand Puppet Sub-Systems Tour - Nicholas Fagerlund, Puppet Labs
The Grand Puppet Sub-Systems Tour - Nicholas Fagerlund, Puppet Labs
 
Puppet Development Workflow
Puppet Development WorkflowPuppet Development Workflow
Puppet Development Workflow
 

Plus de Martin Alfke

CfgMgmtCamp 2023 - Puppet is YAML.pdf
CfgMgmtCamp 2023 - Puppet is YAML.pdfCfgMgmtCamp 2023 - Puppet is YAML.pdf
CfgMgmtCamp 2023 - Puppet is YAML.pdfMartin Alfke
 
PuppetCamp2021-Testing Modules and ControlRepo.pdf
PuppetCamp2021-Testing Modules and ControlRepo.pdfPuppetCamp2021-Testing Modules and ControlRepo.pdf
PuppetCamp2021-Testing Modules and ControlRepo.pdfMartin Alfke
 
Puppet Camp Germany 2020 - Puppet Control Repo and GIT
Puppet Camp Germany 2020 - Puppet Control Repo and GITPuppet Camp Germany 2020 - Puppet Control Repo and GIT
Puppet Camp Germany 2020 - Puppet Control Repo and GITMartin Alfke
 
DevOps - How to get technical buy in
DevOps - How to get technical buy inDevOps - How to get technical buy in
DevOps - How to get technical buy inMartin Alfke
 
ADDO 2019 DevOps in a containerized world
ADDO 2019 DevOps in a containerized worldADDO 2019 DevOps in a containerized world
ADDO 2019 DevOps in a containerized worldMartin Alfke
 
OpenRheinRuhr 2018 - Ops hates containers! Why?
OpenRheinRuhr 2018 - Ops hates containers! Why?OpenRheinRuhr 2018 - Ops hates containers! Why?
OpenRheinRuhr 2018 - Ops hates containers! Why?Martin Alfke
 
Puppet future parser
Puppet future parserPuppet future parser
Puppet future parserMartin Alfke
 
developing sysadmin, sysadmining developersGuug devops puppet
developing sysadmin, sysadmining developersGuug devops puppetdeveloping sysadmin, sysadmining developersGuug devops puppet
developing sysadmin, sysadmining developersGuug devops puppetMartin Alfke
 
Puppet buero20 presentation
Puppet buero20 presentationPuppet buero20 presentation
Puppet buero20 presentationMartin Alfke
 

Plus de Martin Alfke (9)

CfgMgmtCamp 2023 - Puppet is YAML.pdf
CfgMgmtCamp 2023 - Puppet is YAML.pdfCfgMgmtCamp 2023 - Puppet is YAML.pdf
CfgMgmtCamp 2023 - Puppet is YAML.pdf
 
PuppetCamp2021-Testing Modules and ControlRepo.pdf
PuppetCamp2021-Testing Modules and ControlRepo.pdfPuppetCamp2021-Testing Modules and ControlRepo.pdf
PuppetCamp2021-Testing Modules and ControlRepo.pdf
 
Puppet Camp Germany 2020 - Puppet Control Repo and GIT
Puppet Camp Germany 2020 - Puppet Control Repo and GITPuppet Camp Germany 2020 - Puppet Control Repo and GIT
Puppet Camp Germany 2020 - Puppet Control Repo and GIT
 
DevOps - How to get technical buy in
DevOps - How to get technical buy inDevOps - How to get technical buy in
DevOps - How to get technical buy in
 
ADDO 2019 DevOps in a containerized world
ADDO 2019 DevOps in a containerized worldADDO 2019 DevOps in a containerized world
ADDO 2019 DevOps in a containerized world
 
OpenRheinRuhr 2018 - Ops hates containers! Why?
OpenRheinRuhr 2018 - Ops hates containers! Why?OpenRheinRuhr 2018 - Ops hates containers! Why?
OpenRheinRuhr 2018 - Ops hates containers! Why?
 
Puppet future parser
Puppet future parserPuppet future parser
Puppet future parser
 
developing sysadmin, sysadmining developersGuug devops puppet
developing sysadmin, sysadmining developersGuug devops puppetdeveloping sysadmin, sysadmining developersGuug devops puppet
developing sysadmin, sysadmining developersGuug devops puppet
 
Puppet buero20 presentation
Puppet buero20 presentationPuppet buero20 presentation
Puppet buero20 presentation
 

Dernier

TYPES AND DEFINITION OF ONLINE CRIMES AND HAZARDS
TYPES AND DEFINITION OF ONLINE CRIMES AND HAZARDSTYPES AND DEFINITION OF ONLINE CRIMES AND HAZARDS
TYPES AND DEFINITION OF ONLINE CRIMES AND HAZARDSedrianrheine
 
Introduction to ICANN and Fellowship program by Shreedeep Rayamajhi.pdf
Introduction to ICANN and Fellowship program  by Shreedeep Rayamajhi.pdfIntroduction to ICANN and Fellowship program  by Shreedeep Rayamajhi.pdf
Introduction to ICANN and Fellowship program by Shreedeep Rayamajhi.pdfShreedeep Rayamajhi
 
Presentation2.pptx - JoyPress Wordpress
Presentation2.pptx -  JoyPress WordpressPresentation2.pptx -  JoyPress Wordpress
Presentation2.pptx - JoyPress Wordpressssuser166378
 
Computer 10 Lesson 8: Building a Website
Computer 10 Lesson 8: Building a WebsiteComputer 10 Lesson 8: Building a Website
Computer 10 Lesson 8: Building a WebsiteMavein
 
Check out the Free Landing Page Hosting in 2024
Check out the Free Landing Page Hosting in 2024Check out the Free Landing Page Hosting in 2024
Check out the Free Landing Page Hosting in 2024Shubham Pant
 
Zero-day Vulnerabilities
Zero-day VulnerabilitiesZero-day Vulnerabilities
Zero-day Vulnerabilitiesalihassaah1994
 
WordPress by the numbers - Jan Loeffler, CTO WebPros, CloudFest 2024
WordPress by the numbers - Jan Loeffler, CTO WebPros, CloudFest 2024WordPress by the numbers - Jan Loeffler, CTO WebPros, CloudFest 2024
WordPress by the numbers - Jan Loeffler, CTO WebPros, CloudFest 2024Jan Löffler
 
LESSON 10/ GROUP 10/ ST. THOMAS AQUINASS
LESSON 10/ GROUP 10/ ST. THOMAS AQUINASSLESSON 10/ GROUP 10/ ST. THOMAS AQUINASS
LESSON 10/ GROUP 10/ ST. THOMAS AQUINASSlesteraporado16
 
Benefits of doing Internet peering and running an Internet Exchange (IX) pres...
Benefits of doing Internet peering and running an Internet Exchange (IX) pres...Benefits of doing Internet peering and running an Internet Exchange (IX) pres...
Benefits of doing Internet peering and running an Internet Exchange (IX) pres...APNIC
 
LESSON 5 GROUP 10 ST. THOMAS AQUINAS.pdf
LESSON 5 GROUP 10 ST. THOMAS AQUINAS.pdfLESSON 5 GROUP 10 ST. THOMAS AQUINAS.pdf
LESSON 5 GROUP 10 ST. THOMAS AQUINAS.pdfmchristianalwyn
 
Vision Forward: Tracing Image Search SEO From Its Roots To AI-Enhanced Horizons
Vision Forward: Tracing Image Search SEO From Its Roots To AI-Enhanced HorizonsVision Forward: Tracing Image Search SEO From Its Roots To AI-Enhanced Horizons
Vision Forward: Tracing Image Search SEO From Its Roots To AI-Enhanced HorizonsRoxana Stingu
 
Bio Medical Waste Management Guideliness 2023 ppt.pptx
Bio Medical Waste Management Guideliness 2023 ppt.pptxBio Medical Waste Management Guideliness 2023 ppt.pptx
Bio Medical Waste Management Guideliness 2023 ppt.pptxnaveenithkrishnan
 

Dernier (12)

TYPES AND DEFINITION OF ONLINE CRIMES AND HAZARDS
TYPES AND DEFINITION OF ONLINE CRIMES AND HAZARDSTYPES AND DEFINITION OF ONLINE CRIMES AND HAZARDS
TYPES AND DEFINITION OF ONLINE CRIMES AND HAZARDS
 
Introduction to ICANN and Fellowship program by Shreedeep Rayamajhi.pdf
Introduction to ICANN and Fellowship program  by Shreedeep Rayamajhi.pdfIntroduction to ICANN and Fellowship program  by Shreedeep Rayamajhi.pdf
Introduction to ICANN and Fellowship program by Shreedeep Rayamajhi.pdf
 
Presentation2.pptx - JoyPress Wordpress
Presentation2.pptx -  JoyPress WordpressPresentation2.pptx -  JoyPress Wordpress
Presentation2.pptx - JoyPress Wordpress
 
Computer 10 Lesson 8: Building a Website
Computer 10 Lesson 8: Building a WebsiteComputer 10 Lesson 8: Building a Website
Computer 10 Lesson 8: Building a Website
 
Check out the Free Landing Page Hosting in 2024
Check out the Free Landing Page Hosting in 2024Check out the Free Landing Page Hosting in 2024
Check out the Free Landing Page Hosting in 2024
 
Zero-day Vulnerabilities
Zero-day VulnerabilitiesZero-day Vulnerabilities
Zero-day Vulnerabilities
 
WordPress by the numbers - Jan Loeffler, CTO WebPros, CloudFest 2024
WordPress by the numbers - Jan Loeffler, CTO WebPros, CloudFest 2024WordPress by the numbers - Jan Loeffler, CTO WebPros, CloudFest 2024
WordPress by the numbers - Jan Loeffler, CTO WebPros, CloudFest 2024
 
LESSON 10/ GROUP 10/ ST. THOMAS AQUINASS
LESSON 10/ GROUP 10/ ST. THOMAS AQUINASSLESSON 10/ GROUP 10/ ST. THOMAS AQUINASS
LESSON 10/ GROUP 10/ ST. THOMAS AQUINASS
 
Benefits of doing Internet peering and running an Internet Exchange (IX) pres...
Benefits of doing Internet peering and running an Internet Exchange (IX) pres...Benefits of doing Internet peering and running an Internet Exchange (IX) pres...
Benefits of doing Internet peering and running an Internet Exchange (IX) pres...
 
LESSON 5 GROUP 10 ST. THOMAS AQUINAS.pdf
LESSON 5 GROUP 10 ST. THOMAS AQUINAS.pdfLESSON 5 GROUP 10 ST. THOMAS AQUINAS.pdf
LESSON 5 GROUP 10 ST. THOMAS AQUINAS.pdf
 
Vision Forward: Tracing Image Search SEO From Its Roots To AI-Enhanced Horizons
Vision Forward: Tracing Image Search SEO From Its Roots To AI-Enhanced HorizonsVision Forward: Tracing Image Search SEO From Its Roots To AI-Enhanced Horizons
Vision Forward: Tracing Image Search SEO From Its Roots To AI-Enhanced Horizons
 
Bio Medical Waste Management Guideliness 2023 ppt.pptx
Bio Medical Waste Management Guideliness 2023 ppt.pptxBio Medical Waste Management Guideliness 2023 ppt.pptx
Bio Medical Waste Management Guideliness 2023 ppt.pptx
 

Can you upgrade to Puppet 4.x?

  • 1. Can you upgrade to Puppet 4.x? PuppetCamp London Martin Alfke <martin.alfke@buero20.org>
  • 2. Agenda • Why upgrading at all? • Is your code still working? • How to upgrading Puppet? • What brings Puppet 4?
  • 3. About me • Martin Alfke • Berlin/Germany • Freelancer / Trainer • PuppetLabs Training Partner • Puppet User Group Berlin
  • 4. Poll ! ! • Using Puppet 2.x?
  • 5. Poll ! ! • Using Puppet 2.x? • Using Puppet 3.x?
  • 6. Why do I need to bother? • Fast releases • Best Practices • Changing functionality • Removing deprecated stuff • Puppet 4 is coming
  • 7. Why should I upgrade Puppet at all? • Do you want security updates? • Do you want to make use of new functionality? (e.g. automatic data bindings, environmentpath, future parser) • Do you want to get support (community or enterprise)?
  • 8. Is my Puppet DSL code still working on new versions? • Your code was developed some years ago and is still running unmodified • Your code was written on old best practices and does not follow new style guide • You do not check your Puppet runs for deprecation warnings (or do you?)
  • 10. BAD Best practice • Do you inherit from inherited classes? • Do you still use import? • Do you modify remote modules? • Do you access non-local variables without scope names?
  • 11. BAD Best practice Stop doing multiple levels of inheritance ! class foo { } ! class foo::bar inherits foo { } ! class foo::baz inherits foo::bar { } ! class foo::foobar inherits foo::baz { }
  • 12. BAD Best practice Stop doing inheritance ! class foo { } ! class foo::bar inherits foo { } ! class foo::baz inherits foo { } ! class foo::foobar inherits foo { }
  • 13. Best practice Restrict Inheritance ! In most cases you can use parameterised classes instead. Only one kind of inheritance is proven good practice: inherit from module params.pp ! class ssh ( $server = $ssh::params::server, $client = $ssh::params::client, $x11fwd = false, ) inherits ssh::params { } ! class { ::ssh::params:: server => false, x11fwd => true, } BETTER
  • 14. BAD Best practice Stop importing ! # ssh/manifests/init.pp class ssh { import ‘server.pp’ } ! # ssh/manifests/server.pp class ssh::secure { } ! # ssh/manifests/secure.pp class ssh::secure { } ! Which class ssh::secure will be used?
  • 15. Best practice Use include ! In most cases you can make use of the puppet autoloader and you can use include. ! # ssh/manifests/init.pp class ssh { include ::ssh::server } BETTER ! # ssh/manifests/server.pp class ssh::server { } !
  • 16. BAD Best practice Stop modifying remote modules ! Take “remote modules” as a software provided by others. Are you also patching apache?
  • 17. Best practice Co-Work on remote modules ! Do a PR if you want improvements. ! Keep your remote modules upgradeable. BETTER
  • 18. BAD Best practice Stop using non-local variables without scope ! class ssh ( $server = ‘baz’ ) { } ! class ssh::server { notify { $server: } }
  • 19. Best practice Start using non-local variables with scope ! class ssh ( $server = true ) { } ! class ssh::server { notify { $ssh::server: } } BETTER
  • 20. BAD Best practice Stop using un-scoped variables in templates !! key = <%= server %> ! ! !
  • 21. Best practice Start using scoped variables in templates !! BETTER key = <%= @server %> ! or ! key = <%= scope.lookupvar(‘ssh::server’) %> ! or ! key = <%= scope[‘ssh::server’]
  • 22. BAD Best practice Stop using factor variables without top-scope ! class ssh { notify { “We are on OS: $operatingsystem”: } } ! class ssh::server { if $is_virtual { notify { “We are running on $virtual virtualisation”: } } else { notify { “We are running on hardware: $productname”: } }
  • 23. Best practice Start using factor variables with top-scope ! class ssh { notify { “We are on OS: ${::operatingsystem}”: } } ! class ssh::server { if $::is_virtual { notify { “We are running on ${::virtual} virtualisation”: } } else { notify { “We are running on hardware: ${::productname}”: } } BETTER
  • 24. BAD Best practice Stop not doing data validation ! class ssh ( $server = hiera(‘server’, ‘localhost’) ){ notify { “We will use Server: ${server}”: } } !
  • 25. Best practice BETTER Start doing data validation ! class ssh ( $server = hiera(‘server’, ‘localhost’) ){ # validate_string is a function from stdlib validate_string($server) notify { “We will use Server: ${server}”: } } !
  • 26. Remote modules • Do foreign modules support your version? • Newer Puppet versions have new function attributes (arity) • New foreign module versions might need newer modules not supported by your Puppet version
  • 27. Remote modules • Check Puppetfile / metadata.json for requirements • Test prior upgrading in production
  • 28. How can I test my actual Puppet DSL code?
  • 29. How can I test my actual Puppet DSL code? • Syntax/Semantic check • puppet parser validate / puppet-syntax / puppet-lint • Unit test • rspec-puppet • Integration test • beaker, vagrant, serverspec,…
  • 31. Simple rspec upgrade check • Add rspec tests to all your modules and run them locally • Use rvm or rbenv to choose between ruby versions • Provide puppet version to verify in Gemfile • Run spec tests locally and verify results
  • 33. Automatic rspec upgrade check • Install a CI-Server (Jenkins, GO, Teamcity,…) and add build steps • Add git commit hooks to identify changes in repositories • Run rspec tests automatically
  • 35. Simple Puppet upgrade test • Install Puppet tarball in a separate directory on your master • Start puppet master manually using RUBYLIB or ruby -I on another port (—masterport 8141) • Test run from a single node with —noop against the new port
  • 36. Simple Puppet upgrade test Example: additional Puppet Master process: ! tar zxf puppet-3.7.1.tar.gz -C /opt/puppet-3.7.1 ! ruby1.8 -I /opt/puppet-3.7.1/lib /opt/puppet-3.7.1/bin/puppet master —nodaemonize —masterport=8150 —pidfile=/tmp/puppetmaster.pid !! Example: Agent run against additional Puppet Master process: ! puppet agent —test —masterport 8150
  • 37. Demo
  • 38. Puppet 4 • Major update • Removes deprecated functionality • New language features
  • 39. Puppet 4 • Deprecated in Puppet 4: • node inheritance - use roles/profiles instead • upper case variable names • variable with underscore in first position • references to classes using upper case name/title • hypens and periods in names • Ruby DSL
  • 40. Puppet 4 • New in Puppet 4: • Strict variable naming and lookup (will become mandatory in Puppet 5) • Variable type validation • Boolean conversion (“” -> true instead of false) • Environmentpath • Functions in Puppet • New function API
  • 41. Puppet 4 • Further reading • https://github.com/puppetlabs/puppet-specifications • http://puppet-on-the-edge.blogspot.co.uk/
  • 43. You can upgrade to Puppet 4.x! ! Thank you. ! Martin Alfke <martin.alfke@buero20.org>