Ryan Coleman presented on separating code from data in Puppet configurations. He discussed how Hiera can be used to lookup variable data in YAML, JSON, or other formats based on attributes of the node. Built into Puppet 3 is automatic data binding which defaults to using Hiera. Best practices include following the Puppet style guide, using parameterized classes, and not directly calling the hiera() function. The Puppet Forge is a community site for sharing Puppet modules, and private Forge instances may be possible using the PulpProject in the future.
Writing & Sharing Great Modules on the Puppet Forge - Puppet Camp Raleigh
1. @ryanycoleman - Product Owner - Puppet Forge
Data Bindings in Puppet 3 + Puppet Forge
Tuesday, May 21, 13
2. About Me
#PuppetCamp
Tuesday, May 21, 13
Ryan was a RedHat sysadmin for Penn State before joining Puppet Labs
as a professional services engineer. Now is product owner for the Forge.
3. About Me
#PuppetCamp
Tuesday, May 21, 13
Ryan was a RedHat sysadmin for Penn State before joining Puppet Labs
as a professional services engineer. Now is product owner for the Forge.
4. About Me
#PuppetCamp
Tuesday, May 21, 13
Ryan was a RedHat sysadmin for Penn State before joining Puppet Labs
as a professional services engineer. Now is product owner for the Forge.
11. Code VS Data
#PuppetCamp
Tuesday, May 21, 13
As you get further along with your Puppet Deployments, separating your code (puppet
resources) from the data (what package, what version) becomes increasingly important.
12. Tuesday, May 21, 13
Imagine that you’re doing a research project in the library.
13. Tuesday, May 21, 13
You’ve got some books that help accomplish your goal.
28. Configuring Hiera - Backends & Hierarchy
Tuesday, May 21, 13
Hiera lets you express data in some structured format (which is pluggable).
You then establish a hierarchy of lookup, however you like, usually based on facts.
29. Ok, so how do I use it
with my Puppet
classes?
#PuppetCamp
Tuesday, May 21, 13
Thankfully, Puppet 3 has made implementing Hiera really simple.
30. In the early days...
Tuesday, May 21, 13
Please don’t use the hiera() function. Consider it legacy.
31. In the early days...
Tuesday, May 21, 13
This is better, as the user can override this default parameter value.
With this, you’re locked into hiera.
32. Here’s the magic!
Tuesday, May 21, 13
But really, just get yourself onto Puppet 3 and take advantage of automatic Hiera!
33. Data Lookup Order
• Use explicit class declaration
values
• Query Data Binding
• Use the default value from
class.
• Fail compilation with an error if
no value can be found.
Tuesday, May 21, 13
This slide could be more visual vs text-based
34. Data Bindings
we abstract all the things
#PuppetCamp
Tuesday, May 21, 13
Additionally, protect yourself from a potential loss of Hiera.
35. Built into Puppet 3
Tuesday, May 21, 13
data_bindings were implemented to be an abstraction for data lookup, defaulting to hiera for
now
36. Tuesday, May 21, 13
There’s already an alternative out there, for consulting foreman as your data backend
37. Tuesday, May 21, 13
But really, just get yourself onto Puppet 3 and take advantage of automatic Hiera!
38. Tuesday, May 21, 13
Hiera backends are pluggable too. Here are two examples.
60. On-Premise Forge?
Tuesday, May 21, 13
Private Forge has been a common request. The requests I get are two-fold.
A) How can I install public Forge content on a master that can’t reach the outside.
B) How can I contribute company-specific content to a Forge-like thing inside my firewall
61. On-Premise Forge?
Tuesday, May 21, 13
Private Forge has been a common request. The requests I get are two-fold.
A) How can I install public Forge content on a master that can’t reach the outside.
B) How can I contribute company-specific content to a Forge-like thing inside my firewall
62. On-Premise Forge?
Tuesday, May 21, 13
Private Forge has been a common request. The requests I get are two-fold.
A) How can I install public Forge content on a master that can’t reach the outside.
B) How can I contribute company-specific content to a Forge-like thing inside my firewall
63. On-Premise Forge?
Tuesday, May 21, 13
Private Forge has been a common request. The requests I get are two-fold.
A) How can I install public Forge content on a master that can’t reach the outside.
B) How can I contribute company-specific content to a Forge-like thing inside my firewall
64. On-Premise Forge?
Tuesday, May 21, 13
Private Forge has been a common request. The requests I get are two-fold.
A) How can I install public Forge content on a master that can’t reach the outside.
B) How can I contribute company-specific content to a Forge-like thing inside my firewall
65. On-Premise Forge?
Tuesday, May 21, 13
Private Forge has been a common request. The requests I get are two-fold.
A) How can I install public Forge content on a master that can’t reach the outside.
B) How can I contribute company-specific content to a Forge-like thing inside my firewall
66. PulpProject.org
Tuesday, May 21, 13
RedHat’s Pulp Project is repository management software that recently added support for
Puppet Modules.
67. • Manage Modules on-premise
• Mirror Public Forge
• BUT, please work with me on this
• Email me or comment on #5033
• ryan@puppetlabs.com
Tuesday, May 21, 13
If you’re interested in this, email ryan@puppetlabs.com or add your thoughts to https://
projects.puppetlabs.com/issues/5033.
We’re going to do something in this space, but want to hear more from you on what you
need.
68. Want to help?
#PuppetCamp
Tuesday, May 21, 13
If you want to add your influence to our products, join the Puppet Labs Test Pilots program!
https://puppetlabs.com/community/puppet-test-pilots-program/
69. • Sharpen your skills
• Get Certified
• Online learning on the way
• puppetlabs.com/education
#PuppetCamp
Tuesday, May 21, 13
Our education courses are carefully crafted and delivered by our fabulous education team
and professional services team.
Advanced course coming to LA 3/19
Browse upcoming events at http://puppetlabs.eventbrite.com/