• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Puppet Module Best Practices - Puppet Camp Silicon Valley
 

Puppet Module Best Practices - Puppet Camp Silicon Valley

on

  • 1,170 views

Ryan Coleman presents "Puppet Module Best Practices" at Puppet Camp Silicon Valley 2014

Ryan Coleman presents "Puppet Module Best Practices" at Puppet Camp Silicon Valley 2014

Statistics

Views

Total Views
1,170
Views on SlideShare
1,164
Embed Views
6

Actions

Likes
7
Downloads
45
Comments
0

2 Embeds 6

http://puppetlabs.com 4
https://puppetlabs.com 2

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • Ryan was a RedHat sysadmin for Penn State before joining Puppet Labs <br /> as a professional services engineer. Now is product owner for the Forge. <br />
  • The Puppet Forge is a community driven web service for contributing and finding Puppet modules. <br />
  • The following are examples of what you will find on the Forge. <br />
  • Many Puppet modules offer users way too many interaction points or one massive entry point that is too difficult to comprehend. The end result isn’t user friendly and doesn’t help with maintenance either. <br />
  • The answer, use Hiera! <br /> Seriously, these docs rock. Read them. http://docs.puppetlabs.com/hiera/1/index.html <br />
  • But really, just get yourself onto Puppet 3 and take advantage of automatic Hiera! <br />
  • This slide could be more visual vs text-based <br />
  • There’s already an alternative out there, for consulting foreman as your data backend <br />
  • Hiera backends are pluggable too. Here are two examples. <br />
  • If you want to add your influence to our products, join the Puppet Labs Test Pilots program! <br /> https://puppetlabs.com/community/puppet-test-pilots-program/ <br />
  • Seriously, join our team. It’ll be awesome. <br />

Puppet Module Best Practices - Puppet Camp Silicon Valley Puppet Module Best Practices - Puppet Camp Silicon Valley Presentation Transcript

  • Ryan Coleman Writing Better Modules @ryanycoleman | ryan@puppetlabs.com
  • Where I Came From • • • Penn Stater Professional Traveler Blacksmith #PuppetCamp
  • #PuppetCamp
  • #PuppetCamp
  • #PuppetCamp
  • #PuppetCamp
  • #PuppetCamp
  • #PuppetCamp
  • Writing Better Modules #PuppetCamp
  • Why Share?
  • Keep it modular
  • Dependencies can be your friend
  • PL Style Guide #PuppetCamp
  • #PuppetCamp
  • #PuppetCamp
  • #PuppetCamp
  • #PuppetCamp
  • Development Tools
  • Vim • vim-pathogen or vundle (for plugins) • snipmate (like TextMate) • tabular • syntastic • mv-vim-puppet
  • Class Layout & Parameter Naming
  • Tex t http://ruth-tay.deviantart.com
  • VS
  • Private classes should be discrete
  • Validate your input
  • https://github.com/stdmod/pup pet-modules A community-driven effort to standardize on param names
  • Roles & Profiles
  • Roles are the service to be offered, roll-up profiles Profiles merge tech modules with business logic
  • Containment
  • Anchor Pattern
  • Contain (Puppet 3.4+)
  • Documentation the most important part!
  • Answer these questions • What technology does your module manage? • What does it intend to do? • How does it do it? (impact on the system) • How should one use it?
  • http://docs.puppetlabs.com/puppet/3/reference/modules_ documentation.html
  • Versioning
  • Semantic Versioning • Based on Major.Minor.Patch scheme • X.0.0 Major version for breaking change • 0.X.0 Minor version for new non-breaking functionality • 0.0.X Patch version for backwards compatible bug fixes
  • http://links.puppetlabs.com/bgtm
  • Data & Modules
  • Why separate?
  • Two Types of Data • Site • Which port do I bind to? • Logistics • Which package for this OS?
  • Logistics • params.pp • ripienaar/module_data
  • http://forge.puppetlabs.com/ripienaar/module_data http://forge.puppetlabs.com/ripienaar/module_data ./data/operatingsystem/Amazon.yaml Params.pp
  • Site • node definitions • ENC
  • Automatic Data Lookup Built into Puppet 3
  • Here’s the magic!
  • 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.
  • Module Testing A Brief Overview
  • Smoke Testing http://www.dsrsd.com/img/img_wwrw/Sewer_Web.png
  • puppet apply ./tests/apache.pp
  • Unit Testing http://www.pieterg.com/Media/277
  • Integration Testing http://robots.thoughtbot.com/post/33771089985/rspec-integration-tests-with-capybara
  • rspec-system
  • Acceptance Testing
  • Beaker
  • Writing Better Modules • Keep them simple & modular • Consistent Style • Useful Documentation • Separate Code From Data • Test Against Regressions
  • Want to help? #PuppetCamp
  • Thank You! Feel free to email or tweet anytime RE: Forge! ryan@puppetlabs.com - @ryanycoleman forge.puppetlabs.com #PuppetCamp