writing and sharing great modules on the puppet forge

75
@ryanycoleman - Product Owner - Puppet Forge Writing and Sharing Great Modules with the Puppet Forge Tuesday, April 9, 13

Upload: puppet-labs

Post on 02-Jul-2015

5.394 views

Category:

Technology


1 download

DESCRIPTION

Ryan Coleman, Puppet Forge product owner at Puppet Labs, talks about modules at Puppet Camp SF. Download puppet modules on the Puppet Forge: https://forge.puppetlabs.com/

TRANSCRIPT

Page 1: Writing and Sharing Great Modules on the Puppet Forge

@ryanycoleman - Product Owner - Puppet Forge

Writing and Sharing Great Modules with the Puppet Forge

Tuesday, April 9, 13

Page 2: Writing and Sharing Great Modules on the Puppet Forge

About Me

#PuppetCampTuesday, April 9, 13

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 on the Puppet Forge

#PuppetCampTuesday, April 9, 13

The Puppet Forge is a community driven web service for contributing and finding Puppet modules.

Page 4: Writing and Sharing Great Modules on the Puppet Forge

#PuppetCampTuesday, April 9, 13

The following are examples of what you will find on the Forge.

Page 5: Writing and Sharing Great Modules on the Puppet Forge

#PuppetCampTuesday, April 9, 13

Page 6: Writing and Sharing Great Modules on the Puppet Forge

Tuesday, April 9, 13

Page 7: Writing and Sharing Great Modules on the Puppet Forge

Tuesday, April 9, 13

Page 8: Writing and Sharing Great Modules on the Puppet Forge

Tuesday, April 9, 13

Page 9: Writing and Sharing Great Modules on the Puppet Forge

Tuesday, April 9, 13

Page 10: Writing and Sharing Great Modules on the Puppet Forge

Tuesday, April 9, 13

Page 11: Writing and Sharing Great Modules on the Puppet Forge

Tuesday, April 9, 13

Page 12: Writing and Sharing Great Modules on the Puppet Forge

Tuesday, April 9, 13

Page 13: Writing and Sharing Great Modules on the Puppet Forge

Tuesday, April 9, 13

Page 14: Writing and Sharing Great Modules on the Puppet Forge

Tuesday, April 9, 13

Page 15: Writing and Sharing Great Modules on the Puppet Forge

Tuesday, April 9, 13

Page 16: Writing and Sharing Great Modules on the Puppet Forge

0

1000

2000

3000

4000

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

Forge Module Count

#PuppetCampTuesday, April 9, 13

Page 17: Writing and Sharing Great Modules on the Puppet Forge

#PuppetCampTuesday, April 9, 13

Page 18: Writing and Sharing Great Modules on the Puppet Forge

#PuppetCampTuesday, April 9, 13

Page 19: Writing and Sharing Great Modules on the Puppet Forge

#PuppetCampTuesday, April 9, 13

Page 20: Writing and Sharing Great Modules on the Puppet Forge

Best Good Practices

#PuppetCampTuesday, April 9, 13

Page 21: Writing and Sharing Great Modules on the Puppet Forge

PL Style Guide#PuppetCampTuesday, April 9, 13

Page 22: Writing and Sharing Great Modules on the Puppet Forge

#PuppetCampTuesday, April 9, 13

Page 23: Writing and Sharing Great Modules on the Puppet Forge

#PuppetCampTuesday, April 9, 13

Page 24: Writing and Sharing Great Modules on the Puppet Forge

#PuppetCampTuesday, April 9, 13

Page 25: Writing and Sharing Great Modules on the Puppet Forge

#PuppetCampTuesday, April 9, 13

Page 26: Writing and Sharing Great Modules on the Puppet Forge

Code VS Data

#PuppetCampTuesday, April 9, 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.

Page 27: Writing and Sharing Great Modules on the Puppet Forge

Tuesday, April 9, 13

Imagine that you’re doing a research project in the library.

Page 28: Writing and Sharing Great Modules on the Puppet Forge

Tuesday, April 9, 13

You’ve got some books that help accomplish your goal.

Page 29: Writing and Sharing Great Modules on the Puppet Forge

Separate

Code From

Data

Tuesday, April 9, 13

But you don’t write in those books. You keep your notes -- your data -- separate.

Page 30: Writing and Sharing Great Modules on the Puppet Forge

Tuesday, April 9, 13

Page 31: Writing and Sharing Great Modules on the Puppet Forge

Tuesday, April 9, 13

So where do you express your data and how does Puppet find it?

Page 32: Writing and Sharing Great Modules on the Puppet Forge

Automatic Data LookupBuilt into Puppet 3

Tuesday, April 9, 13

Page 33: Writing and Sharing Great Modules on the Puppet Forge

Tuesday, April 9, 13

The answer, use Hiera!

Seriously, these docs rock. Read them. http://docs.puppetlabs.com/hiera/1/index.html

Page 34: Writing and Sharing Great Modules on the Puppet Forge

It’s MAGICBut also, it’s not...

#PuppetCampTuesday, April 9, 13

But first, let’s take a closer look at a Puppet run.

Page 35: Writing and Sharing Great Modules on the Puppet Forge

Tuesday, April 9, 13

Page 36: Writing and Sharing Great Modules on the Puppet Forge

Tuesday, April 9, 13

Page 37: Writing and Sharing Great Modules on the Puppet Forge

Hello! I’m James_Bond running the RedHat

license to kill downtime.

Tuesday, April 9, 13

Page 38: Writing and Sharing Great Modules on the Puppet Forge

Good to know!

Hmm, what does James_Bond need to

enforce?.

Tuesday, April 9, 13

Page 39: Writing and Sharing Great Modules on the Puppet Forge

James_Bond?

External Node Classifier

Enforce Forge

Modules

OK, what do I need for Forge?

Modules

Modules Modules

Tuesday, April 9, 13

Page 40: Writing and Sharing Great Modules on the Puppet Forge

forge::package?

Data Bindings

Hiera

YAMLJSON

MySQL Foreman

Backends$clientcert

$operatingsystem

common

Hiearchy

Tuesday, April 9, 13

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 on the Puppet Forge

It’s screen!

forge::package?

Data Bindings

Hiera

YAMLJSON

MySQL Redis

Backends$clientcert

$operatingsystem

common

Hiearchy

Tuesday, April 9, 13

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 42: Writing and Sharing Great Modules on the Puppet Forge

? $forge::package

$clientcert

$operatingsystem

common

Hiearchy

$james_bond

$RedHat

common

Tuesday, April 9, 13

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 43: Writing and Sharing Great Modules on the Puppet Forge

Expressing the configuration of hieradata backends and lookup hierarchy

Tuesday, April 9, 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.

Page 44: Writing and Sharing Great Modules on the Puppet Forge

Ok, so how do I use it with my Puppet

classes?

#PuppetCampTuesday, April 9, 13

Thankfully, Puppet 3 has made implementing Hiera really simple.

Page 45: Writing and Sharing Great Modules on the Puppet Forge

In the early days...

Tuesday, April 9, 13

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

Page 46: Writing and Sharing Great Modules on the Puppet Forge

In the early days...

Tuesday, April 9, 13

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

With this, you’re locked into hiera.

Page 47: Writing and Sharing Great Modules on the Puppet Forge

Here’s the magic!

Tuesday, April 9, 13

But really, just get yourself onto Puppet 3 and take advantage of automatic Hiera!

Page 48: Writing and Sharing Great Modules on the Puppet Forge

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, April 9, 13

This slide could be more visual vs text-based

Page 49: Writing and Sharing Great Modules on the Puppet Forge

Data Bindingsdon’t lock yourself in

#PuppetCampTuesday, April 9, 13

Additionally, protect yourself from a potential loss of Hiera.

Page 50: Writing and Sharing Great Modules on the Puppet Forge

Built into Puppet 3

Tuesday, April 9, 13

data_bindings were implemented to be an abstraction for data lookup, defaulting to hiera for now

Page 51: Writing and Sharing Great Modules on the Puppet Forge

Tuesday, April 9, 13

There’s already an alternative out there, for consulting foreman as your data backend

Page 52: Writing and Sharing Great Modules on the Puppet Forge

Tuesday, April 9, 13

But really, just get yourself onto Puppet 3 and take advantage of automatic Hiera!

Page 53: Writing and Sharing Great Modules on the Puppet Forge

Tuesday, April 9, 13

Hiera backends are pluggable too. Here are two examples.

Page 54: Writing and Sharing Great Modules on the Puppet Forge

Tuesday, April 9, 13

Page 55: Writing and Sharing Great Modules on the Puppet Forge

Best Practices

• Confirm to the Style Guide

• Use Parameterized Classes

• Don’t use hiera() directly

#PuppetCampTuesday, April 9, 13

Re-cap.

Page 56: Writing and Sharing Great Modules on the Puppet Forge

The Team

Tuesday, April 9, 13

Page 57: Writing and Sharing Great Modules on the Puppet Forge

What have we been up to?

• Re-launch and Re-design

Tuesday, April 9, 13

Though we’re small, we’ve been really busy!

Page 58: Writing and Sharing Great Modules on the Puppet Forge

Tuesday, April 9, 13

Page 59: Writing and Sharing Great Modules on the Puppet Forge

Tuesday, April 9, 13

Lots of little features add up to a substantially nicer to use Forge.

Page 60: Writing and Sharing Great Modules on the Puppet Forge

Tuesday, April 9, 13

Download counts, now in your search results!

Page 61: Writing and Sharing Great Modules on the Puppet Forge

GitHub-based Module Publish

[email protected], April 9, 13

Edit 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 on the Puppet Forge

A Full & Public API

What’s Next?

Tuesday, April 9, 13

Also coming soon, an actual API for doing all sorts of things with the Forge.

Page 63: Writing and Sharing Great Modules on the Puppet Forge

What’s Next?

Tuesday, April 9, 13

Just an experimental mock-up of search results. Actual feature will absolutely look and behave differently.

Page 64: Writing and Sharing Great Modules on the Puppet Forge

On-Premise Forge?

Tuesday, April 9, 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

Page 65: Writing and Sharing Great Modules on the Puppet Forge

On-Premise Forge?

Tuesday, April 9, 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

Page 66: Writing and Sharing Great Modules on the Puppet Forge

On-Premise Forge?

Tuesday, April 9, 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

Page 67: Writing and Sharing Great Modules on the Puppet Forge

On-Premise Forge?

Tuesday, April 9, 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

Page 68: Writing and Sharing Great Modules on the Puppet Forge

On-Premise Forge?

Tuesday, April 9, 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

Page 69: Writing and Sharing Great Modules on the Puppet Forge

On-Premise Forge?

Tuesday, April 9, 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

Page 70: Writing and Sharing Great Modules on the Puppet Forge

PulpProject.org

Tuesday, April 9, 13

RedHat’s Pulp Project is repository management software that recently added support for Puppet Modules.

Page 71: Writing and Sharing Great Modules on the Puppet Forge

• Manage Modules on-premise

• Mirror Public Forge

• BUT, please work with me on this

• Email me or comment on #5033

[email protected]

Tuesday, April 9, 13

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 on the Puppet Forge

Want to help?

#PuppetCampTuesday, April 9, 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/

Page 73: Writing and Sharing Great Modules on the Puppet Forge

• Sharpen your skills

• Get Certified

• Online learning on the way

• puppetlabs.com/education

#PuppetCampTuesday, April 9, 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/

Page 74: Writing and Sharing Great Modules on the Puppet Forge

Tuesday, April 9, 13

Page 75: Writing and Sharing Great Modules on the Puppet Forge

Thank You!

Please email (or tweet) feedback and questions

[email protected] - @ryanycoleman

forge.puppetlabs.com

puppetlabs.com/jobs

#PuppetCampTuesday, April 9, 13

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