Writing and Sharing Great Modules
            with the Puppet Forge


@ryanycoleman - Product Owner - Puppet Forge
About Me




#PuppetCamp
Ryan was a RedHat sysadmin for Penn State before joining Puppet Labs
as a professional services engineer. Now is product owner for the Forge.
#PuppetCamp
The Puppet Forge is a community driven web service for contributing and finding Puppet
modules.
#PuppetCamp
Word cloud made from forge module names. Size = frequency
#PuppetCamp
The following are examples of what you will find on the Forge.
#PuppetCamp
Forge Module Count

  4000


  3000


  2000


  1000


     0
         End Q3   End Q4   ~End Q1   ~End Q2   ~End Q3   ~End Q4




#PuppetCamp
#PuppetCamp
#PuppetCamp
#PuppetCamp
Best Good Practices



#PuppetCamp
PL Style Guide
#PuppetCamp
#PuppetCamp
#PuppetCamp
#PuppetCamp
#PuppetCamp
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.
Imagine that you’re doing a research project in the library.
You’ve got some books that help accomplish your goal.
Separate
             Code
               From
              Data



But you don’t write in those books. You keep your notes -- your data -- separate.
So where do you express your data and how does Puppet find it?
Automatic Data Lookup
 Built into Puppet 3
The answer, use Hiera!

Seriously, these docs rock. Read them. http://docs.puppetlabs.com/hiera/1/index.html
It’s MAGIC
                                                      But also, it’s not...




#PuppetCamp
But first, let’s take a closer look at a Puppet run.
Hello! I’m James_Bond
   running the RedHat
license to kill downtime.
Good to know!


  Hmm, what does
James_Bond need to
     enforce?.
James_Bond?



                  Enforce    External Node
                   Forge       Classifier

 OK, what do I
need for Forge?

Modules Modules
Modules Modules
forge::package?

                                                                         Data
                                                                       Bindings

                                                   Hiera


                       Hiearchy
                                                                   Backends
                   $clientcert

               $operatingsystem
                                                         JSON           YAML
                                                        MySQL Foreman
                      common


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)
forge::package?

                                                                         Data
                                                                       Bindings
                                         It’s screen!

                                                   Hiera


                       Hiearchy
                                                                   Backends
                   $clientcert

               $operatingsystem
                                                         JSON           YAML
                                                        MySQL            Redis
                      common


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)
? $forge::package
        Hiearchy
      $clientcert                                                   $james_bond

   $operatingsystem                                                      $RedHat

         common                                                          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.
Expressing the configuration of hiera
            data 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.
Ok, so how do I use it
  with my Puppet
       classes?

#PuppetCamp
Thankfully, Puppet 3 has made implementing Hiera really simple.
In the early days...




Please don’t use the hiera() function. Consider it legacy.
In the early days...




This is better, as the user can override this default parameter value.

With this, you’re locked into hiera.
Here’s the magic!




But really, just get yourself onto Puppet 3 and take advantage of automatic Hiera!
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
Data Bindings
                                 don’t lock yourself in




#PuppetCamp
Additionally, protect yourself from a potential loss of Hiera.
Built into Puppet 3




data_bindings were implemented to be an abstraction for data lookup, defaulting to hiera for
now
There’s already an alternative out there, for consulting foreman as your data backend
But really, just get yourself onto Puppet 3 and take advantage of automatic Hiera!
Hiera backends are pluggable too. Here are two examples.
Best Practices


          • Confirm to the Style Guide
          • Use Parameterized Classes
          • Don’t use hiera() directly

#PuppetCamp
Re-cap.
The
Team
What have we been
              up to?


          • Re-launch and Re-design



Though we’re small, we’ve been really busy!
Lots of little features add up to a substantially nicer to use Forge.
What have we been
      up to?

• Re-launch and Re-design
• PMT Fixes (prep for publish)
• Download Counts
Download counts, now in your search results!
What’s Next?




        GitHub Publish
Edit your Modulefile, push your commit and we’ll do the publishing! Coming soon to a
repository near you.
What’s Next?




     A Full & Public API
Also coming soon, an actual API for doing all sorts of things with the Forge.
What’s Next?




Just an experimental mock-up of search results. Actual feature will absolutely look and
behave differently.
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
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
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
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
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
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
PulpProject.org




RedHat’s Pulp Project is repository management software that recently added support for
Puppet Modules.
• 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 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.
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/
• Sharpen your skills
              • Get Certified
              • Online learning on the way
              • puppetlabs.com/education
Puppet Advanced Training in Atlanta - June 11
   http://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/
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.
Thank You!

       Please email (or tweet) feedback and questions

               ryan@puppetlabs.com - @ryanycoleman

                              forge.puppetlabs.com
                                puppetlabs.com/jobs




#PuppetCamp
Seriously, join our team. It’ll be awesome.

Writing and Sharing Great Modules with the Puppet Forge

  • 1.
    Writing and SharingGreat Modules with the Puppet Forge @ryanycoleman - Product Owner - Puppet Forge
  • 2.
    About Me #PuppetCamp Ryan wasa RedHat sysadmin for Penn State before joining Puppet Labs as a professional services engineer. Now is product owner for the Forge.
  • 3.
    #PuppetCamp The Puppet Forgeis a community driven web service for contributing and finding Puppet modules.
  • 4.
    #PuppetCamp Word cloud madefrom forge module names. Size = frequency
  • 5.
    #PuppetCamp The following areexamples of what you will find on the Forge.
  • 6.
  • 15.
    Forge Module Count 4000 3000 2000 1000 0 End Q3 End Q4 ~End Q1 ~End Q2 ~End Q3 ~End Q4 #PuppetCamp
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
    Code VS Data #PuppetCamp Asyou get further along with your Puppet Deployments, separating your code (puppet resources) from the data (what package, what version) becomes increasingly important.
  • 26.
    Imagine that you’redoing a research project in the library.
  • 27.
    You’ve got somebooks that help accomplish your goal.
  • 28.
    Separate Code From Data But you don’t write in those books. You keep your notes -- your data -- separate.
  • 30.
    So where doyou express your data and how does Puppet find it?
  • 31.
    Automatic Data Lookup Built into Puppet 3
  • 32.
    The answer, useHiera! Seriously, these docs rock. Read them. http://docs.puppetlabs.com/hiera/1/index.html
  • 33.
    It’s MAGIC But also, it’s not... #PuppetCamp But first, let’s take a closer look at a Puppet run.
  • 36.
    Hello! I’m James_Bond running the RedHat license to kill downtime.
  • 37.
    Good to know! Hmm, what does James_Bond need to enforce?.
  • 38.
    James_Bond? Enforce External Node Forge Classifier OK, what do I need for Forge? Modules Modules Modules Modules
  • 39.
    forge::package? Data Bindings Hiera Hiearchy Backends $clientcert $operatingsystem JSON YAML MySQL Foreman common 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)
  • 40.
    forge::package? Data Bindings It’s screen! Hiera Hiearchy Backends $clientcert $operatingsystem JSON YAML MySQL Redis common 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)
  • 41.
    ? $forge::package Hiearchy $clientcert $james_bond $operatingsystem $RedHat common 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.
  • 42.
    Expressing the configurationof hiera data 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.
  • 43.
    Ok, so howdo I use it with my Puppet classes? #PuppetCamp Thankfully, Puppet 3 has made implementing Hiera really simple.
  • 44.
    In the earlydays... Please don’t use the hiera() function. Consider it legacy.
  • 45.
    In the earlydays... This is better, as the user can override this default parameter value. With this, you’re locked into hiera.
  • 46.
    Here’s the magic! Butreally, just get yourself onto Puppet 3 and take advantage of automatic Hiera!
  • 47.
    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
  • 48.
    Data Bindings don’t lock yourself in #PuppetCamp Additionally, protect yourself from a potential loss of Hiera.
  • 49.
    Built into Puppet3 data_bindings were implemented to be an abstraction for data lookup, defaulting to hiera for now
  • 50.
    There’s already analternative out there, for consulting foreman as your data backend
  • 51.
    But really, justget yourself onto Puppet 3 and take advantage of automatic Hiera!
  • 52.
    Hiera backends arepluggable too. Here are two examples.
  • 54.
    Best Practices • Confirm to the Style Guide • Use Parameterized Classes • Don’t use hiera() directly #PuppetCamp Re-cap.
  • 55.
  • 56.
    What have webeen up to? • Re-launch and Re-design Though we’re small, we’ve been really busy!
  • 58.
    Lots of littlefeatures add up to a substantially nicer to use Forge.
  • 59.
    What have webeen up to? • Re-launch and Re-design • PMT Fixes (prep for publish) • Download Counts
  • 60.
    Download counts, nowin your search results!
  • 61.
    What’s Next? GitHub Publish Edit your Modulefile, push your commit and we’ll do the publishing! Coming soon to a repository near you.
  • 62.
    What’s Next? A Full & Public API Also coming soon, an actual API for doing all sorts of things with the Forge.
  • 63.
    What’s Next? Just anexperimental mock-up of search results. Actual feature will absolutely look and behave differently.
  • 64.
    On-Premise Forge? Private Forgehas 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? Private Forgehas 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.
    On-Premise Forge? Private Forgehas 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
  • 67.
    On-Premise Forge? Private Forgehas 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
  • 68.
    On-Premise Forge? Private Forgehas 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
  • 69.
    On-Premise Forge? Private Forgehas 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
  • 70.
    PulpProject.org RedHat’s Pulp Projectis repository management software that recently added support for Puppet Modules.
  • 71.
    • Manage Moduleson-premise • Mirror Public Forge • BUT, please work with me on this • Email me or comment on #5033 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.
  • 72.
    Want to help? #PuppetCamp Ifyou want to add your influence to our products, join the Puppet Labs Test Pilots program! https://puppetlabs.com/community/puppet-test-pilots-program/
  • 73.
    • Sharpen yourskills • Get Certified • Online learning on the way • puppetlabs.com/education Puppet Advanced Training in Atlanta - June 11 http://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/
  • 74.
    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.
  • 75.
    Thank You! Please email (or tweet) feedback and questions ryan@puppetlabs.com - @ryanycoleman forge.puppetlabs.com puppetlabs.com/jobs #PuppetCamp Seriously, join our team. It’ll be awesome.