r10k Puppet workflow 
what it is, and why you should be doing it
Bob Rasey 
Linuxing for 15 years 
Puppeting for about 18 months
Puppet workflow? 
Config management is now code. 
Best practices for code means 
version control 
code review 
environments 
You’re doing this, right?
Puppet 
What is this “version control”? 
Modules live in directories. 
How to do environments? 
What about Puppet Forge modules? 
What about Hiera data?
Hiera 
No more hard-coded things!
Hiera 
More code! 
Lives in its own repository. 
Also, environments.
Git 
Environments - how? 
one repo per? 
environment = commit SHA? 
branches?
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?
Complexity 
Custom Puppet modules - dev 
Custom Puppet modules - test 
Custom Puppet modules - production 
Puppet Forge modules - dev 
Puppet Forge modules - test 
Puppet Forge modules - production 
Hiera data - dev 
Hiera data - test 
Hiera data - production 
???
Please tell me you’re not going to write some 
bash / ssh / rsync / cron magic to do this...
r10k 
Ruby gem 
Written by Adrien Thebo 
Does all the things
r10k 
Two methods do everything: 
sync Git repos/branches with directories 
custom Puppetry - check 
hieradata - check 
environments - check 
Puppetfile 
Puppet Forge - check
r10k - Git 
Environments = Git branches. 
Git repo = a directory. 
Git branches = directories under that.
r10k - Puppetfile 
Puppetfile is like a Ruby gemfile. 
Describes modules to install. 
Good for Puppet Forge modules.
Configuration 
In your Puppet modules repo 
a branch for each environment 
In each branch (environment) 
Puppetfile describing Forge modules 
environment.conf 
manifests directory with site.pp 
dist directory contains custom Puppet modules
├── 
│ └── 
├── 
├── 
│ └── 
└── 
Git repo 
Note: no modules directory! 
Because r10k populates it on the server 
according to what’s in the Puppetfile. 
Put custom modules in dist.
Configuration 
On the Puppet Master 
/etc/r10k.yaml 
/etc/puppet/puppet.conf edits
├── 
│ ├── 
│ ├── 
│ ├── 
│ ├── 
│ └── 
└── 
├── 
│ └── 
├── 
├── 
├── 
│ └── 
│ └── 
└── 
Puppet Master 
Contents of /etc/puppet/environments. 
albatross module deployed in testing, but 
not production. 
puppetlabs-motd too.
Configuration 
On the node 
/etc/puppet/puppet.conf 
environment = testing
Puppet workflow 
Everything should live in git 
Use pull requests (code review) 
Use pre-commit hooks (syntax, style) 
Test config changes in dev 
Promote code changes 
Start thinking like a developer
Other stuff 
Masterless Puppet via Puppetfile 
Jenkins build triggered by change in repo 
Dynamic environments
Contact 
brasey@gmail.com
Further reading 
Adrien 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.mkd 
https://docs.puppetlabs.com/puppet/latest/reference/environments_configuring.html 
Puppetfile r10k: 
https://github.com/adrienthebo/r10k/blob/master/doc/puppetfile.mkd

Puppet Camp Atlanta 2014: r10k Puppet Workflow

  • 1.
    r10k Puppet workflow what it is, and why you should be doing it
  • 2.
    Bob Rasey Linuxingfor 15 years Puppeting for about 18 months
  • 3.
    Puppet workflow? Configmanagement is now code. Best practices for code means version control code review environments You’re doing this, right?
  • 4.
    Puppet What isthis “version control”? Modules live in directories. How to do environments? What about Puppet Forge modules? What about Hiera data?
  • 5.
    Hiera No morehard-coded things!
  • 6.
    Hiera More code! Lives in its own repository. Also, environments.
  • 7.
    Git Environments -how? one repo per? environment = commit SHA? branches?
  • 8.
    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?
  • 9.
    Complexity Custom Puppetmodules - dev Custom Puppet modules - test Custom Puppet modules - production Puppet Forge modules - dev Puppet Forge modules - test Puppet Forge modules - production Hiera data - dev Hiera data - test Hiera data - production ???
  • 10.
    Please tell meyou’re not going to write some bash / ssh / rsync / cron magic to do this...
  • 11.
    r10k Ruby gem Written by Adrien Thebo Does all the things
  • 12.
    r10k Two methodsdo everything: sync Git repos/branches with directories custom Puppetry - check hieradata - check environments - check Puppetfile Puppet Forge - check
  • 13.
    r10k - Git Environments = Git branches. Git repo = a directory. Git branches = directories under that.
  • 14.
    r10k - Puppetfile Puppetfile is like a Ruby gemfile. Describes modules to install. Good for Puppet Forge modules.
  • 15.
    Configuration In yourPuppet modules repo a branch for each environment In each branch (environment) Puppetfile describing Forge modules environment.conf manifests directory with site.pp dist directory contains custom Puppet modules
  • 16.
    ├── │ └── ├── ├── │ └── └── Git repo Note: no modules directory! Because r10k populates it on the server according to what’s in the Puppetfile. Put custom modules in dist.
  • 17.
    Configuration On thePuppet Master /etc/r10k.yaml /etc/puppet/puppet.conf edits
  • 18.
    ├── │ ├── │ ├── │ ├── │ ├── │ └── └── ├── │ └── ├── ├── ├── │ └── │ └── └── Puppet Master Contents of /etc/puppet/environments. albatross module deployed in testing, but not production. puppetlabs-motd too.
  • 19.
    Configuration On thenode /etc/puppet/puppet.conf environment = testing
  • 20.
    Puppet workflow Everythingshould live in git Use pull requests (code review) Use pre-commit hooks (syntax, style) Test config changes in dev Promote code changes Start thinking like a developer
  • 21.
    Other stuff MasterlessPuppet via Puppetfile Jenkins build triggered by change in repo Dynamic environments
  • 22.
  • 23.
    Further reading AdrienThebo 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.mkd https://docs.puppetlabs.com/puppet/latest/reference/environments_configuring.html Puppetfile r10k: https://github.com/adrienthebo/r10k/blob/master/doc/puppetfile.mkd