puppet camp atlanta 2014: r10k puppet workflow

23
r10k Puppet workflow what it is, and why you should be doing it

Upload: puppet-labs

Post on 07-Jul-2015

999 views

Category:

Software


0 download

TRANSCRIPT

Page 1: Puppet Camp Atlanta 2014: r10k Puppet Workflow

r10k Puppet workflowwhat it is, and why you should be doing it

Page 2: Puppet Camp Atlanta 2014: r10k Puppet Workflow

Bob Rasey

Linuxing for 15 yearsPuppeting for about 18 months

Page 3: Puppet Camp Atlanta 2014: r10k Puppet Workflow

Puppet workflow?

Config management is now code.Best practices for code means

version controlcode reviewenvironments

You’re doing this, right?

Page 4: Puppet Camp Atlanta 2014: r10k Puppet Workflow

Puppet

What is this “version control”?Modules live in directories.How to do environments?What about Puppet Forge modules?What about Hiera data?

Page 5: Puppet Camp Atlanta 2014: r10k Puppet Workflow

Hiera

No more hard-coded things!

Page 6: Puppet Camp Atlanta 2014: r10k Puppet Workflow

Hiera

More code!Lives in its own repository.Also, environments.

Page 7: Puppet Camp Atlanta 2014: r10k Puppet Workflow

Git

Environments - how?one repo per?environment = commit SHA?branches?

Page 8: Puppet Camp Atlanta 2014: r10k Puppet Workflow

Puppet Forge modules

You should be using them.How do you promote through environments?Do you really want to manage them?

Git fork?static copy?pin to Git commit SHA? How?

Page 9: Puppet Camp Atlanta 2014: r10k Puppet Workflow

ComplexityCustom Puppet modules - devCustom Puppet modules - testCustom Puppet modules - productionPuppet Forge modules - devPuppet Forge modules - testPuppet Forge modules - productionHiera data - devHiera data - testHiera data - production

???

Page 10: Puppet Camp Atlanta 2014: r10k Puppet Workflow

Please tell me you’re not going to write some bash / ssh / rsync / cron magic to do this...

Page 11: Puppet Camp Atlanta 2014: r10k Puppet Workflow

r10k

Ruby gemWritten by Adrien TheboDoes all the things

Page 12: Puppet Camp Atlanta 2014: r10k Puppet Workflow

r10k

Two methods do everything:sync Git repos/branches with directories

custom Puppetry - checkhieradata - checkenvironments - check

PuppetfilePuppet Forge - check

Page 13: Puppet Camp Atlanta 2014: r10k Puppet Workflow

r10k - Git

Environments = Git branches.Git repo = a directory.Git branches = directories under that.

Page 14: Puppet Camp Atlanta 2014: r10k Puppet Workflow

r10k - Puppetfile

Puppetfile is like a Ruby gemfile.Describes modules to install.Good for Puppet Forge modules.

Page 15: Puppet Camp Atlanta 2014: r10k Puppet Workflow

Configuration

In your Puppet modules repoa branch for each environment

In each branch (environment)Puppetfile describing Forge modulesenvironment.confmanifests directory with site.ppdist directory contains custom Puppet modules

Page 16: Puppet Camp Atlanta 2014: r10k Puppet Workflow

├──│ └──├──├──│ └──└──

Note: no modules directory!

Because r10k populates it on the server according to what’s in the Puppetfile.

Put custom modules in dist.

Git repo

Page 17: Puppet Camp Atlanta 2014: r10k Puppet Workflow

Configuration

On the Puppet Master/etc/r10k.yaml/etc/puppet/puppet.conf edits

Page 18: Puppet Camp Atlanta 2014: r10k Puppet Workflow

├──│ ├──│ ├──│ ├──│ ├──│ └──└──

├──│ └──├──├──├──│ └──│ └──└──

Contents of /etc/puppet/environments.

albatross module deployed in testing, but not production.

puppetlabs-motd too.

Puppet Master

Page 19: Puppet Camp Atlanta 2014: r10k Puppet Workflow

Configuration

On the node/etc/puppet/puppet.conf

environment = testing

Page 20: Puppet Camp Atlanta 2014: r10k Puppet Workflow

Puppet workflow

Everything should live in gitUse pull requests (code review)Use pre-commit hooks (syntax, style)Test config changes in devPromote code changesStart thinking like a developer

Page 21: Puppet Camp Atlanta 2014: r10k Puppet Workflow

Other stuff

Masterless Puppet via PuppetfileJenkins build triggered by change in repoDynamic environments

Page 22: Puppet Camp Atlanta 2014: r10k Puppet Workflow

Contact

[email protected]

Page 23: Puppet Camp Atlanta 2014: r10k Puppet Workflow

Further readingAdrien Thebo on creating r10k:http://somethingsinistral.net/blog/rethinking-puppet-deployment/Gary Larizza on doing r10k:http://garylarizza.com/blog/2014/08/31/r10k-plus-directory-environments/Configuring Directory Environments on the Puppet Master:https://github.com/adrienthebo/r10k/blob/master/doc/dynamic-environments/master-configuration.mkdhttps://docs.puppetlabs.com/puppet/latest/reference/environments_configuring.htmlPuppetfile r10k:https://github.com/adrienthebo/r10k/blob/master/doc/puppetfile.mkd