Publishing A Module On The
Puppet Forge
An introduction to packaging your module and
sharing it with the community
Bill Fr...
Agenda
•
•
•
•
•
•
•

2

Introduction
Why you should publish your module
What is a module, anyway?
Managing configuration ...
Introduction

3

© 2014 Pythian
Why Publish A Module?
•
•
•
•
•
•
•

4

Major strength of Puppet
Over 2000 modules
Integration via Puppet Module Tool
Meta...
Truth In Advertising
•
•
•
•
•

5

Documentation exists
Adheres to best practice
Dependency resolution
Semantic versioning...
What Is A Module?
1.
2.
3.
4.

6

Identify Problem
Solve Problem
???
Profit!

© 2014 Pythian
What Is A Module?
/etc/puppet/modules/widget/manifests/init.pp

7

© 2014 Pythian
What Is A Module?
• widget – Top-level matches the name of the module
– manifests/ – All of the manifests for the module
•...
puppet module generate
•

Modulefile
– Module metadata
– Dependency information

•
•

9

README
spec_helper.rb

© 2014 Pyt...
Managing Configuration With Style!
• “Just because you can, doesn’t mean you should”
• By Conforming to the style guide, y...
puppet-lint
• Install puppet-lint

• Run puppet-lint

• But wait, let’s make it more awesome!

11

© 2014 Pythian
puppet-lint
• Gemfile

• Rakefile

12

© 2014 Pythian
Continuous Integration
• Automatic testing against multiple Ruby and / or
Puppet versions
• Travis CI and GitHub
– Sign in...
Continuous Integration
Add .travis.yml to your module repository

14

© 2014 Pythian
Continuous Integration

15

© 2014 Pythian
Next Steps
• Test Driven Development (TDD)
• Behaviour Driven Development (BDD)
• rspec-puppet
• rspec-system

16

© 2014 ...
References
•
•
•
•
•
•
•

17

Puppet Forge: http://forge.puppetlabs.com/
Style Guide: http://docs.puppetlabs.com/guides/st...
Questions?
Thank you!

Bill Fraser
fraser@pythian.com

18

© 2014 Pythian
Upcoming SlideShare
Loading in …5
×

Publishing a Module on the Puppet Forge

1,568 views

Published on

"Publishing a Module on the Puppet Forge" by Bill Fraser of Pythian at the Ottawa Puppet User Group, Feb 2014.

Published in: Technology
0 Comments
4 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,568
On SlideShare
0
From Embeds
0
Number of Embeds
4
Actions
Shares
0
Downloads
30
Comments
0
Likes
4
Embeds 0
No embeds

No notes for slide

Publishing a Module on the Puppet Forge

  1. 1. Publishing A Module On The Puppet Forge An introduction to packaging your module and sharing it with the community Bill Fraser February 25, 2014
  2. 2. Agenda • • • • • • • 2 Introduction Why you should publish your module What is a module, anyway? Managing configuration with style! Continuous integration Next steps Q&A © 2014 Pythian
  3. 3. Introduction 3 © 2014 Pythian
  4. 4. Why Publish A Module? • • • • • • • 4 Major strength of Puppet Over 2000 modules Integration via Puppet Module Tool Metadata (version, release date, downloads) Searchable Documentation (requirements, parameters, usage) Giving back to the community © 2014 Pythian
  5. 5. Truth In Advertising • • • • • 5 Documentation exists Adheres to best practice Dependency resolution Semantic versioning Automated test and build © 2014 Pythian
  6. 6. What Is A Module? 1. 2. 3. 4. 6 Identify Problem Solve Problem ??? Profit! © 2014 Pythian
  7. 7. What Is A Module? /etc/puppet/modules/widget/manifests/init.pp 7 © 2014 Pythian
  8. 8. What Is A Module? • widget – Top-level matches the name of the module – manifests/ – All of the manifests for the module • init.pp – Main class definition for the module • doodad.pp – Class named widget::doodad – files/ – Location for static files – lib/ – Contains plugins, custom facts / resources – templates/ – Contains templates – tests/ – Examples of how to declare classes / types – spec/ – Contains spec tests 8 © 2014 Pythian
  9. 9. puppet module generate • Modulefile – Module metadata – Dependency information • • 9 README spec_helper.rb © 2014 Pythian
  10. 10. Managing Configuration With Style! • “Just because you can, doesn’t mean you should” • By Conforming to the style guide, you ensure that – – – – You follow best practice in module design and style Your module is readable and therefore easier to maintain Your module will work with an ENC without requiring one You do not inherit or declare other classes unless you need to • puppet-lint is your friend! 10 © 2014 Pythian
  11. 11. puppet-lint • Install puppet-lint • Run puppet-lint • But wait, let’s make it more awesome! 11 © 2014 Pythian
  12. 12. puppet-lint • Gemfile • Rakefile 12 © 2014 Pythian
  13. 13. Continuous Integration • Automatic testing against multiple Ruby and / or Puppet versions • Travis CI and GitHub – Sign in through GitHub OAuth and grant read and write access to GitHub – Activate GitHub service hooks – Add .travis.yml to your module repository – Validate your .travis.yml file with travis-lint – Trigger a build 13 © 2014 Pythian
  14. 14. Continuous Integration Add .travis.yml to your module repository 14 © 2014 Pythian
  15. 15. Continuous Integration 15 © 2014 Pythian
  16. 16. Next Steps • Test Driven Development (TDD) • Behaviour Driven Development (BDD) • rspec-puppet • rspec-system 16 © 2014 Pythian
  17. 17. References • • • • • • • 17 Puppet Forge: http://forge.puppetlabs.com/ Style Guide: http://docs.puppetlabs.com/guides/style_guide.html Publishing Modules on the Puppet Forge: http://docs.puppetlabs.com/puppet/latest/reference/modules_publishing.html puppet-lint: http://puppet-lint.com/ Travis CI: https://travis-ci.org/ Pro Puppet, Second Edition: http://www.apress.com/9781430260400 GDash Module – Puppet Forge: http://forge.puppetlabs.com/bfraser/gdash – GitHub: https://github.com/bfraser/puppet-gdash © 2014 Pythian
  18. 18. Questions? Thank you! Bill Fraser fraser@pythian.com 18 © 2014 Pythian

×