![Page 1: Writing and Sharing Great Modules with the Puppet Forge](https://reader033.vdocuments.site/reader033/viewer/2022051819/54c79f604a7959b5408b4586/html5/thumbnails/1.jpg)
@ryanycoleman - Product Owner - Puppet Forge
Writing and Sharing Great Modules with the Puppet Forge
![Page 2: Writing and Sharing Great Modules with the Puppet Forge](https://reader033.vdocuments.site/reader033/viewer/2022051819/54c79f604a7959b5408b4586/html5/thumbnails/2.jpg)
About Me
#PuppetCamp
Ryan was a RedHat sysadmin for Penn State before joining Puppet Labsas a professional services engineer. Now is product owner for the Forge.
![Page 3: Writing and Sharing Great Modules with the Puppet Forge](https://reader033.vdocuments.site/reader033/viewer/2022051819/54c79f604a7959b5408b4586/html5/thumbnails/3.jpg)
#PuppetCamp
The Puppet Forge is a community driven web service for contributing and finding Puppet modules.
![Page 4: Writing and Sharing Great Modules with the Puppet Forge](https://reader033.vdocuments.site/reader033/viewer/2022051819/54c79f604a7959b5408b4586/html5/thumbnails/4.jpg)
#PuppetCampWord cloud made from forge module names. Size = frequency
![Page 5: Writing and Sharing Great Modules with the Puppet Forge](https://reader033.vdocuments.site/reader033/viewer/2022051819/54c79f604a7959b5408b4586/html5/thumbnails/5.jpg)
#PuppetCampThe following are examples of what you will find on the Forge.
![Page 6: Writing and Sharing Great Modules with the Puppet Forge](https://reader033.vdocuments.site/reader033/viewer/2022051819/54c79f604a7959b5408b4586/html5/thumbnails/6.jpg)
#PuppetCamp
![Page 7: Writing and Sharing Great Modules with the Puppet Forge](https://reader033.vdocuments.site/reader033/viewer/2022051819/54c79f604a7959b5408b4586/html5/thumbnails/7.jpg)
![Page 8: Writing and Sharing Great Modules with the Puppet Forge](https://reader033.vdocuments.site/reader033/viewer/2022051819/54c79f604a7959b5408b4586/html5/thumbnails/8.jpg)
![Page 9: Writing and Sharing Great Modules with the Puppet Forge](https://reader033.vdocuments.site/reader033/viewer/2022051819/54c79f604a7959b5408b4586/html5/thumbnails/9.jpg)
![Page 10: Writing and Sharing Great Modules with the Puppet Forge](https://reader033.vdocuments.site/reader033/viewer/2022051819/54c79f604a7959b5408b4586/html5/thumbnails/10.jpg)
![Page 11: Writing and Sharing Great Modules with the Puppet Forge](https://reader033.vdocuments.site/reader033/viewer/2022051819/54c79f604a7959b5408b4586/html5/thumbnails/11.jpg)
![Page 12: Writing and Sharing Great Modules with the Puppet Forge](https://reader033.vdocuments.site/reader033/viewer/2022051819/54c79f604a7959b5408b4586/html5/thumbnails/12.jpg)
![Page 13: Writing and Sharing Great Modules with the Puppet Forge](https://reader033.vdocuments.site/reader033/viewer/2022051819/54c79f604a7959b5408b4586/html5/thumbnails/13.jpg)
![Page 14: Writing and Sharing Great Modules with the Puppet Forge](https://reader033.vdocuments.site/reader033/viewer/2022051819/54c79f604a7959b5408b4586/html5/thumbnails/14.jpg)
![Page 15: Writing and Sharing Great Modules with the Puppet Forge](https://reader033.vdocuments.site/reader033/viewer/2022051819/54c79f604a7959b5408b4586/html5/thumbnails/15.jpg)
0
1000
2000
3000
4000
End Q3 End Q4 ~End Q1 ~End Q2 ~End Q3 ~End Q4
Forge Module Count
#PuppetCamp
![Page 16: Writing and Sharing Great Modules with the Puppet Forge](https://reader033.vdocuments.site/reader033/viewer/2022051819/54c79f604a7959b5408b4586/html5/thumbnails/16.jpg)
#PuppetCamp
![Page 17: Writing and Sharing Great Modules with the Puppet Forge](https://reader033.vdocuments.site/reader033/viewer/2022051819/54c79f604a7959b5408b4586/html5/thumbnails/17.jpg)
#PuppetCamp
![Page 18: Writing and Sharing Great Modules with the Puppet Forge](https://reader033.vdocuments.site/reader033/viewer/2022051819/54c79f604a7959b5408b4586/html5/thumbnails/18.jpg)
#PuppetCamp
![Page 19: Writing and Sharing Great Modules with the Puppet Forge](https://reader033.vdocuments.site/reader033/viewer/2022051819/54c79f604a7959b5408b4586/html5/thumbnails/19.jpg)
Best Good Practices
#PuppetCamp
![Page 20: Writing and Sharing Great Modules with the Puppet Forge](https://reader033.vdocuments.site/reader033/viewer/2022051819/54c79f604a7959b5408b4586/html5/thumbnails/20.jpg)
PL Style Guide#PuppetCamp
![Page 21: Writing and Sharing Great Modules with the Puppet Forge](https://reader033.vdocuments.site/reader033/viewer/2022051819/54c79f604a7959b5408b4586/html5/thumbnails/21.jpg)
#PuppetCamp
![Page 22: Writing and Sharing Great Modules with the Puppet Forge](https://reader033.vdocuments.site/reader033/viewer/2022051819/54c79f604a7959b5408b4586/html5/thumbnails/22.jpg)
#PuppetCamp
![Page 23: Writing and Sharing Great Modules with the Puppet Forge](https://reader033.vdocuments.site/reader033/viewer/2022051819/54c79f604a7959b5408b4586/html5/thumbnails/23.jpg)
#PuppetCamp
![Page 24: Writing and Sharing Great Modules with the Puppet Forge](https://reader033.vdocuments.site/reader033/viewer/2022051819/54c79f604a7959b5408b4586/html5/thumbnails/24.jpg)
#PuppetCamp
![Page 25: Writing and Sharing Great Modules with the Puppet Forge](https://reader033.vdocuments.site/reader033/viewer/2022051819/54c79f604a7959b5408b4586/html5/thumbnails/25.jpg)
Code VS Data
#PuppetCamp
As you get further along with your Puppet Deployments, separating your code (puppet resources) from the data (what package, what version) becomes increasingly important.
![Page 26: Writing and Sharing Great Modules with the Puppet Forge](https://reader033.vdocuments.site/reader033/viewer/2022051819/54c79f604a7959b5408b4586/html5/thumbnails/26.jpg)
Imagine that you’re doing a research project in the library.
![Page 27: Writing and Sharing Great Modules with the Puppet Forge](https://reader033.vdocuments.site/reader033/viewer/2022051819/54c79f604a7959b5408b4586/html5/thumbnails/27.jpg)
You’ve got some books that help accomplish your goal.
![Page 28: Writing and Sharing Great Modules with the Puppet Forge](https://reader033.vdocuments.site/reader033/viewer/2022051819/54c79f604a7959b5408b4586/html5/thumbnails/28.jpg)
Separate
Code From
Data
But you don’t write in those books. You keep your notes -- your data -- separate.
![Page 29: Writing and Sharing Great Modules with the Puppet Forge](https://reader033.vdocuments.site/reader033/viewer/2022051819/54c79f604a7959b5408b4586/html5/thumbnails/29.jpg)
![Page 30: Writing and Sharing Great Modules with the Puppet Forge](https://reader033.vdocuments.site/reader033/viewer/2022051819/54c79f604a7959b5408b4586/html5/thumbnails/30.jpg)
So where do you express your data and how does Puppet find it?
![Page 31: Writing and Sharing Great Modules with the Puppet Forge](https://reader033.vdocuments.site/reader033/viewer/2022051819/54c79f604a7959b5408b4586/html5/thumbnails/31.jpg)
Automatic Data LookupBuilt into Puppet 3
![Page 32: Writing and Sharing Great Modules with the Puppet Forge](https://reader033.vdocuments.site/reader033/viewer/2022051819/54c79f604a7959b5408b4586/html5/thumbnails/32.jpg)
The answer, use Hiera!
Seriously, these docs rock. Read them. http://docs.puppetlabs.com/hiera/1/index.html
![Page 33: Writing and Sharing Great Modules with the Puppet Forge](https://reader033.vdocuments.site/reader033/viewer/2022051819/54c79f604a7959b5408b4586/html5/thumbnails/33.jpg)
It’s MAGICBut also, it’s not...
#PuppetCamp
But first, let’s take a closer look at a Puppet run.
![Page 34: Writing and Sharing Great Modules with the Puppet Forge](https://reader033.vdocuments.site/reader033/viewer/2022051819/54c79f604a7959b5408b4586/html5/thumbnails/34.jpg)
![Page 35: Writing and Sharing Great Modules with the Puppet Forge](https://reader033.vdocuments.site/reader033/viewer/2022051819/54c79f604a7959b5408b4586/html5/thumbnails/35.jpg)
![Page 36: Writing and Sharing Great Modules with the Puppet Forge](https://reader033.vdocuments.site/reader033/viewer/2022051819/54c79f604a7959b5408b4586/html5/thumbnails/36.jpg)
Hello! I’m James_Bond running the RedHat
license to kill downtime.
![Page 37: Writing and Sharing Great Modules with the Puppet Forge](https://reader033.vdocuments.site/reader033/viewer/2022051819/54c79f604a7959b5408b4586/html5/thumbnails/37.jpg)
Good to know!
Hmm, what does James_Bond need to
enforce?.
![Page 38: Writing and Sharing Great Modules with the Puppet Forge](https://reader033.vdocuments.site/reader033/viewer/2022051819/54c79f604a7959b5408b4586/html5/thumbnails/38.jpg)
James_Bond?
External Node Classifier
Enforce Forge
Modules
OK, what do I need for Forge?
Modules
Modules Modules
![Page 39: Writing and Sharing Great Modules with the Puppet Forge](https://reader033.vdocuments.site/reader033/viewer/2022051819/54c79f604a7959b5408b4586/html5/thumbnails/39.jpg)
forge::package?
Data Bindings
Hiera
YAMLJSON
MySQL Foreman
Backends$clientcert
$operatingsystem
common
Hiearchy
The Puppet Master needs forge::package. To get this data...- It consults its data bindings terminus (abstraction for looking up data)- Default lookup to Hiera (key/value store for data)- Hiera consults its back-end data stores (defaults to yaml)- Hiera returns result of lookup to master (key/value or could not find)
![Page 40: Writing and Sharing Great Modules with the Puppet Forge](https://reader033.vdocuments.site/reader033/viewer/2022051819/54c79f604a7959b5408b4586/html5/thumbnails/40.jpg)
It’s screen!
forge::package?
Data Bindings
Hiera
YAMLJSON
MySQL Redis
Backends$clientcert
$operatingsystem
common
Hiearchy
The Puppet Master needs forge::package. To get this data...- It consults its data bindings terminus (abstraction for looking up data)- Default lookup to Hiera (key/value store for data)- Hiera consults its back-end data stores (defaults to yaml)- Hiera returns result of lookup to master (key/value or could not find)
![Page 41: Writing and Sharing Great Modules with the Puppet Forge](https://reader033.vdocuments.site/reader033/viewer/2022051819/54c79f604a7959b5408b4586/html5/thumbnails/41.jpg)
? $forge::package
$clientcert
$operatingsystem
common
Hiearchy
$james_bond
$RedHat
common
Hiera will examine the lookup order of its data backends and its lookup hierarchy. If you specified a variable lookup in your hierarchy, Hiera will use available facts when choosing the backend file to lookup.
![Page 42: Writing and Sharing Great Modules with the Puppet Forge](https://reader033.vdocuments.site/reader033/viewer/2022051819/54c79f604a7959b5408b4586/html5/thumbnails/42.jpg)
Expressing the configuration of hieradata backends and lookup hierarchy
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.
![Page 43: Writing and Sharing Great Modules with the Puppet Forge](https://reader033.vdocuments.site/reader033/viewer/2022051819/54c79f604a7959b5408b4586/html5/thumbnails/43.jpg)
Ok, so how do I use it with my Puppet
classes?
#PuppetCamp
Thankfully, Puppet 3 has made implementing Hiera really simple.
![Page 44: Writing and Sharing Great Modules with the Puppet Forge](https://reader033.vdocuments.site/reader033/viewer/2022051819/54c79f604a7959b5408b4586/html5/thumbnails/44.jpg)
In the early days...
Please don’t use the hiera() function. Consider it legacy.
![Page 45: Writing and Sharing Great Modules with the Puppet Forge](https://reader033.vdocuments.site/reader033/viewer/2022051819/54c79f604a7959b5408b4586/html5/thumbnails/45.jpg)
In the early days...
This is better, as the user can override this default parameter value.
With this, you’re locked into hiera.
![Page 46: Writing and Sharing Great Modules with the Puppet Forge](https://reader033.vdocuments.site/reader033/viewer/2022051819/54c79f604a7959b5408b4586/html5/thumbnails/46.jpg)
Here’s the magic!
But really, just get yourself onto Puppet 3 and take advantage of automatic Hiera!
![Page 47: Writing and Sharing Great Modules with the Puppet Forge](https://reader033.vdocuments.site/reader033/viewer/2022051819/54c79f604a7959b5408b4586/html5/thumbnails/47.jpg)
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.
This slide could be more visual vs text-based
![Page 48: Writing and Sharing Great Modules with the Puppet Forge](https://reader033.vdocuments.site/reader033/viewer/2022051819/54c79f604a7959b5408b4586/html5/thumbnails/48.jpg)
Data Bindingsdon’t lock yourself in
#PuppetCamp
Additionally, protect yourself from a potential loss of Hiera.
![Page 49: Writing and Sharing Great Modules with the Puppet Forge](https://reader033.vdocuments.site/reader033/viewer/2022051819/54c79f604a7959b5408b4586/html5/thumbnails/49.jpg)
Built into Puppet 3
data_bindings were implemented to be an abstraction for data lookup, defaulting to hiera for now
![Page 50: Writing and Sharing Great Modules with the Puppet Forge](https://reader033.vdocuments.site/reader033/viewer/2022051819/54c79f604a7959b5408b4586/html5/thumbnails/50.jpg)
There’s already an alternative out there, for consulting foreman as your data backend
![Page 51: Writing and Sharing Great Modules with the Puppet Forge](https://reader033.vdocuments.site/reader033/viewer/2022051819/54c79f604a7959b5408b4586/html5/thumbnails/51.jpg)
But really, just get yourself onto Puppet 3 and take advantage of automatic Hiera!
![Page 52: Writing and Sharing Great Modules with the Puppet Forge](https://reader033.vdocuments.site/reader033/viewer/2022051819/54c79f604a7959b5408b4586/html5/thumbnails/52.jpg)
Hiera backends are pluggable too. Here are two examples.
![Page 53: Writing and Sharing Great Modules with the Puppet Forge](https://reader033.vdocuments.site/reader033/viewer/2022051819/54c79f604a7959b5408b4586/html5/thumbnails/53.jpg)
![Page 54: Writing and Sharing Great Modules with the Puppet Forge](https://reader033.vdocuments.site/reader033/viewer/2022051819/54c79f604a7959b5408b4586/html5/thumbnails/54.jpg)
Best Practices
• Confirm to the Style Guide
• Use Parameterized Classes
• Don’t use hiera() directly
#PuppetCamp
Re-cap.
![Page 55: Writing and Sharing Great Modules with the Puppet Forge](https://reader033.vdocuments.site/reader033/viewer/2022051819/54c79f604a7959b5408b4586/html5/thumbnails/55.jpg)
The Team
![Page 56: Writing and Sharing Great Modules with the Puppet Forge](https://reader033.vdocuments.site/reader033/viewer/2022051819/54c79f604a7959b5408b4586/html5/thumbnails/56.jpg)
What have we been up to?
• Re-launch and Re-design
Though we’re small, we’ve been really busy!
![Page 57: Writing and Sharing Great Modules with the Puppet Forge](https://reader033.vdocuments.site/reader033/viewer/2022051819/54c79f604a7959b5408b4586/html5/thumbnails/57.jpg)
![Page 58: Writing and Sharing Great Modules with the Puppet Forge](https://reader033.vdocuments.site/reader033/viewer/2022051819/54c79f604a7959b5408b4586/html5/thumbnails/58.jpg)
Lots of little features add up to a substantially nicer to use Forge.
![Page 59: Writing and Sharing Great Modules with the Puppet Forge](https://reader033.vdocuments.site/reader033/viewer/2022051819/54c79f604a7959b5408b4586/html5/thumbnails/59.jpg)
What have we been up to?
• Re-launch and Re-design
• PMT Fixes (prep for publish)
• Download Counts
![Page 60: Writing and Sharing Great Modules with the Puppet Forge](https://reader033.vdocuments.site/reader033/viewer/2022051819/54c79f604a7959b5408b4586/html5/thumbnails/60.jpg)
Download counts, now in your search results!
![Page 61: Writing and Sharing Great Modules with the Puppet Forge](https://reader033.vdocuments.site/reader033/viewer/2022051819/54c79f604a7959b5408b4586/html5/thumbnails/61.jpg)
What’s Next?
GitHub PublishEdit your Modulefile, push your commit and we’ll do the publishing! Coming soon to a repository near you.
![Page 62: Writing and Sharing Great Modules with the Puppet Forge](https://reader033.vdocuments.site/reader033/viewer/2022051819/54c79f604a7959b5408b4586/html5/thumbnails/62.jpg)
A Full & Public API
What’s Next?
Also coming soon, an actual API for doing all sorts of things with the Forge.
![Page 63: Writing and Sharing Great Modules with the Puppet Forge](https://reader033.vdocuments.site/reader033/viewer/2022051819/54c79f604a7959b5408b4586/html5/thumbnails/63.jpg)
What’s Next?
Just an experimental mock-up of search results. Actual feature will absolutely look and behave differently.
![Page 64: Writing and Sharing Great Modules with the Puppet Forge](https://reader033.vdocuments.site/reader033/viewer/2022051819/54c79f604a7959b5408b4586/html5/thumbnails/64.jpg)
On-Premise Forge?
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
![Page 65: Writing and Sharing Great Modules with the Puppet Forge](https://reader033.vdocuments.site/reader033/viewer/2022051819/54c79f604a7959b5408b4586/html5/thumbnails/65.jpg)
On-Premise Forge?
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
![Page 66: Writing and Sharing Great Modules with the Puppet Forge](https://reader033.vdocuments.site/reader033/viewer/2022051819/54c79f604a7959b5408b4586/html5/thumbnails/66.jpg)
On-Premise Forge?
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
![Page 67: Writing and Sharing Great Modules with the Puppet Forge](https://reader033.vdocuments.site/reader033/viewer/2022051819/54c79f604a7959b5408b4586/html5/thumbnails/67.jpg)
On-Premise Forge?
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
![Page 68: Writing and Sharing Great Modules with the Puppet Forge](https://reader033.vdocuments.site/reader033/viewer/2022051819/54c79f604a7959b5408b4586/html5/thumbnails/68.jpg)
On-Premise Forge?
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
![Page 69: Writing and Sharing Great Modules with the Puppet Forge](https://reader033.vdocuments.site/reader033/viewer/2022051819/54c79f604a7959b5408b4586/html5/thumbnails/69.jpg)
On-Premise Forge?
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
![Page 70: Writing and Sharing Great Modules with the Puppet Forge](https://reader033.vdocuments.site/reader033/viewer/2022051819/54c79f604a7959b5408b4586/html5/thumbnails/70.jpg)
PulpProject.org
RedHat’s Pulp Project is repository management software that recently added support for Puppet Modules.
![Page 71: Writing and Sharing Great Modules with the Puppet Forge](https://reader033.vdocuments.site/reader033/viewer/2022051819/54c79f604a7959b5408b4586/html5/thumbnails/71.jpg)
• Manage Modules on-premise
• Mirror Public Forge
• BUT, please work with me on this
• Email me or comment on #5033
If you’re interested in this, email [email protected] 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.
![Page 72: Writing and Sharing Great Modules with the Puppet Forge](https://reader033.vdocuments.site/reader033/viewer/2022051819/54c79f604a7959b5408b4586/html5/thumbnails/72.jpg)
Want to help?
#PuppetCamp
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/
![Page 73: Writing and Sharing Great Modules with the Puppet Forge](https://reader033.vdocuments.site/reader033/viewer/2022051819/54c79f604a7959b5408b4586/html5/thumbnails/73.jpg)
• Sharpen your skills
• Get Certified
• Online learning on the way
• puppetlabs.com/education
Puppet Advanced Training in Atlanta - June 11http://puppet-advanced-training-atlanta-
june-2013-eorg.eventbrite.com/
#PuppetCamp
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/
![Page 74: Writing and Sharing Great Modules with the Puppet Forge](https://reader033.vdocuments.site/reader033/viewer/2022051819/54c79f604a7959b5408b4586/html5/thumbnails/74.jpg)
WE’RE HIRING!
• Puppet Forge Module Engineer
• http://bit.ly/15wdruk
• Software Engineers
• puppetlabs.com/jobs
#PuppetCamp
Seriously, join our team. It’ll be awesome.
![Page 75: Writing and Sharing Great Modules with the Puppet Forge](https://reader033.vdocuments.site/reader033/viewer/2022051819/54c79f604a7959b5408b4586/html5/thumbnails/75.jpg)
Thank You!
Please email (or tweet) feedback and questions
[email protected] - @ryanycoleman
forge.puppetlabs.com
puppetlabs.com/jobs
#PuppetCamp
Seriously, join our team. It’ll be awesome.