Here are the slides from Nate McCurdy & Elizabeth Wittig Plumb's PuppetConf 2016 presentation called PuppetConf 2016: Getting to the Latest Puppet. Watch the videos at https://www.youtube.com/playlist?list=PLV86BgbREluVjwwt-9UL8u2Uy8xnzpIqa
4. 4
Language
● Iteration!
● Type system
○ Class parameter validation
○ Future proof for additional
awesomeness
● Cleaner Puppet code
○ No more reliance on stdlib
functions
Other
● All-in-one agent packaging
● New features in Puppet
Enterprise
● Stability and scalability
… because Puppet 4 is AWESOME
6. 6
Ch-Ch-Ch-Ch-Changes
Code Changes
We’ve got a new
compiler & new
language features
Directory Changes
The all-in-one agent
means we’ve moved
some things around
Classification
Changes
Do you use the
import( ) function?
Console Changes
Whoa! Look at all
those node groups!
https://docs.puppet.com/puppet/latest/reference/lang_updating_manifests.html
9. Preview Box, where you’ll make sure the
code is ready for the future
Puppet Enterprise latest, your agents
will aspire to be here
9
So here’s what you’ve gotta do:
Preview Box:
• Puppet Enterprise 3.8 Master
• Catalog Preview module installed
• r10k (or a copy of your code)
• parser = future
Puppet Enterprise
2016.4 Master
Puppet Agents
10. Fast Feedback Loop Doesn’t impact work
the agent is doing
Compare your catalogs in
Puppet 3 vs 4
Why guess?
A 3.8 master with the catalog preview module
https://forge.puppet.com/puppetlabs/catalog_preview
10
What’s a preview box?
16. Differences: This could get messy
--excludes
</path/to/excludes.json>
--[no-]diff-array-value
Here are some handy flags to filter out info you don’t care about
16
--[no-]diff-string-numeric
22. Workflow Steps: Step 4
Generate first report.
● Run Puppet Preview
● Convert JSON to HTML
22
[root@pe-386-master]# puppet preview
--baseline-environment production
--preview-environment future_production
--migrate 3.8/4.0
--nodes nodes.txt
--view overview-json | tee ~/overview.json
[root@pe-386-master]# preview_report.rb
-f ~/overview.json
-w ~/preview_report.html
23. Workflow Steps: Step 5
Find an issue to fix.
Start with any catalog compilation
errors, then move to migration
warnings / differences
23
Baseline Errors (by manifest)
Nodes..: agiledbtest2.example.com
Issues.:
'Duplicate declaration: File[u01] is already
declared in file
/etc/puppetlabs/puppet/environments/production/
site/example/manifests/oracle.pp:351; cannot
redeclare
24. Workflow Steps: Step 6
Fix the issue.
For simple changes, modify code in
future_production
For more complex issues, create a
branch off of future_production for
that issue
24
25. Workflow Steps: Step 7
Deploy change to preview box, and run
the preview tool again.
Ensure that your issue has been fixed.
25
[root@pe-386-master]# r10k deploy environment -pv
[INFO] Deploying environment “production”
[INFO] Deploying environment “future_production”
[root@pe-386-master]# puppet preview
--baseline-environment production
--preview-environment future_production
--migrate 3.8/4.0
--nodes nodes.txt
--view overview-json | tee ~/fix_file_mode.json
[root@pe-386-master]# preview_report.rb
-f ~/fix_file_mode.json
-w ~/fix_file_mode.html
31. We need to test
Catalog Application!
● On the new infrastructure!
● Migrate CA certs to new infrastructure
● puppet agent -t --noop
--server=new_infra
--environment=future_production
● Merge into production when everything’s
fixed
31
33. All this is happening on your diff box, not on your prod systems
33
Don’t worry. Be happy.
Catalogs are being compiled using only facts and your code
34. There’s 2 ways to get facts on the preview box
Query PuppetDB directly Yaml facts cache
34
puppet master --configprint route_file
35. YAML Facts
If you have thousands of
nodes, start with a
representative cross
section.
35
[root@pe-386-master ~]# puppet master --configprint yamldir
/var/opt/lib/pe-puppet/yaml
[root@pe-386-master ~]# tree -C /var/opt/lib/pe-puppet/yaml
/var/opt/lib/pe-puppet/yaml
├── facts
│ ├── agileappprod1.example.com.yaml
│ ├── agileappprod2.example.com.yaml
│ ├── agileappstage1.example.com.yaml
│ ├── agileappstage2.example.com.yaml
(...)
puppet preview
--nodes roles.txt
https://github.com/natemccurdy/puppet-upgrade-workplace
36. Upgrade your agents with the
puppet_agent module and you’re done!
https://forge.puppet.com/puppetlabs/puppet_agent
36