Killer R10K

Automating the Killer
Robots, all 10K of Them

Who Am I

Early Days
R10K Workflow Awesomeness
Demo Time


Monolithic Repo .The Journey of A Thousand Miles Begins With A Single.

A Single Repo? What the F*@K?!! .

Why Put Everything in a Single Repo? Simplify Development Easy Jenkins Flow Puppet Code and Hiera Data Together .

Just Starting Out .


Single CI Job • • • rspec-puppet syntax check lint For All Modules Single Release Job • create/push tag Single Deploy Job • Capistrano tasks • poor man’s dynamic environments • kludgy git logic w/conditionals in Capfile .

Forge M o dules Capistrano -> Puppet Module Tool e k r o W t ’ n d i D t I l i t n U … l l e dW .

Did I mention the KLUDGY Capistrano tasks? .

else \ git clone #{module_repository} #{environment_basedir}/ #{branchname} --branch #{branchname} . fi" else puts "Please provide a valid git branch name as an argument" end end . :roles => :puppet_master do if exists?(:branchname) run "if [ -d #{environment_basedir}/#{branchname} ].task "create_puppet_env". then cd #{environment_basedir}/#{branchname} && git pull origin #{branchname} .

fi" else puts "Please provide a valid git branch name as an argument" end end .task "create_puppet_env". then cd #{environment_basedir}/#{branchname} && git pull origin #{branchname} . :roles => :puppet_master do if exists?(:branchname) run "if [ -d #{environment_basedir}/#{branchname} ]. else \ git clone #{module_repository} #{environment_basedir}/ #{branchname} --branch #{branchname} .

s e l u d o M e g r o F e d Upgra Version Management == Face Palm Upgradin g Affects a ll Environ ments! .

Simple Comes at a Price Let Me Count the Other Ways… This Started to Fail .

“I only changed one module…. You mean I have to wait for tests to run for ALL modules before I know if my changes are good?” .


“I only changed one module…. I have to deploy everything in order to get my changes on the masters? Sigh” .

I have to deploy everything just to get my hiera data on the masters?” .“I need to change some hiera data….

I’m Losing My Patience! .

and that little production… Stop the Madness !! .problem where upgrading forge modules can break Oh .


Recap of Early Days: Monolithic Repo Long CI Cycles All-Or-Nothing Deploys Upgrading Forge Modules .


Tools Can Be Awesome (we just needed a couple more) .

Make Them Work For You .

R10K .

R10K .

com/ adrienthebo/r10k .R10K! https://github.

Deploys Puppet Code Handles Is Git/Svn Fu Awesome .

R10K and Puppetfile ) d n a l t r o P r o ( n e v a e H n i e d a M h c t a M Manage Modul e Versi ons Inventory of Puppet Environment .

Puppetfile Format .

lives in its
Inventory of
and Their

lives in its own

Inventory of
Modules and
Their Versions

own repository AND r10k Each module in its .

R10K Deploy .

r10k deploy environment test -p deploys all modules in Puppetfile for the test branch r10k deploy module tomcat deploys a single module! .

CI Job Per Module • • • rspec-puppet syntax check lint Release Job Per Module • • create/push tag select module from dropdown list Deploy Job For Each Module And Hiera • • simpler Capistrano tasks wrap r10k calls to each master/node .

use r10k to deploy all modules for the specified environment. :roles => :puppet_master do if exists?(:branchname) run "r10k -v debug deploy environment #{branchname} -p" else puts "Please provide a valid git branch name as an argument" end end ." task "update_environment".desc "for specified branch in puppetfile repo.

Puppetfile Manipulation and Branch Creation .

0. :ref => 'RELEASE_1.rr.Tomcat Example mod 'tomcat'.13' .webapps.git'. :git => '

go to tomcat dir (production branch) ! ‘git checkout -b dev_change_foo’ ‘git push origin dev_change_foo’ .

Create the ‘dev_change_foo’ branch in Puppetfile repo .

Change the :ref for tomcat to ‘dev_change_foo’ .

Call r10k to deploy ‘dev_change_foo’ Notify Me When It’s Finished .


Explain the Magics Hint: .

Create Branch r10k deploy environment .

Modify Branch r10k deploy module .

Delete Branch auto-delete Puppetfile branch .

Testing Multiple Modules in the Same Environment .

go to profile dir (production branch) ! ‘git checkout -b dev_change_foo’ ‘git push origin dev_change_foo’ .

com:fylgia/' mod 'tomcat'.webapps.1.git'.13' mod 'profile'.rr. :git => 'git@github.git'. :ref => 'RELEASE_1.mod 'profile'.rr.webapps.rr.rr. :git => 'git@github. production :ref => 'RELEASE_0. dev_change_foo :ref => ‘dev_change_foo’ mod 'tomcat'.git'. :git => 'git@github.webapps.git'. :git => ' :ref => 'dev_change_foo' .com:fylgia/profile.0.

Truly Dynamic Environments! .

The Post-Receive Hook reaktor .

Default Setup GitHub or GitHub Enterprise Hipchat Just provide some config! .


Slack.Other Chat Providers Campfire. etc If it has an API. it’s pluggable! .

Other Git Providers Gitlab. Bitbucket. etc Need to Determine Best Approach .

e r C e s a e l e R e t a Deploy .Shi p It! .

Create Release Modulefile versionfile (hieradata) RELEASE_1.14 .0.13 -> RELEASE_1.0.

Deploy Parameterized Job environment version to deploy .

Puppetfile Manipulation (again) change :ref to selected version commit/push updated Puppetfile r10k deploy selected environment .

One-Click Production Deploy .


Workflow Recap: R10K and Puppetfile Each Module in Own Repo Post-Receive Hook Goodness Production Deployments .




Conclusion: Early Days R10K Workflow Awesomeness Demos .

com/2014/05/02/an-automated-r10k-workflow-that-works/ https://github.Helpful Links and References .com/adrienthebo/r10k http://garylarizza.

Sign up to vote on this title
UsefulNot useful