Ask Your Question
0

Install & setup r10k on open source puppet v4

asked 2017-03-01 22:51:30 -0500

cm01 gravatar image

Hi Guys,

is there an up to date / modern guide to installing and setting up r10k on Open Source(!) Puppet v4.?
All the links I've found seem to refer to v3 eg $confdir/environments instead of $codedir/environments and /etc/puppet/ instead of /etc/puppetlabs/whatever..
I'm worried that if I try to use any of the associated modules/tools, they will go wrong on my v4 servers.

BTW: I've downloaded and unrolled the zip file from the main r10k site on github, as our systems are isolated from the internet.

Thanks
Chris

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2017-03-02 03:47:35 -0500

craymore gravatar image

Hello,

I don't have a dedicated guide to the r10k setup for Puppet OSE, but I can provide you with the basics ( based on the setup I currently have )

  • the r10k gem is installed within the puppetserver sandbox
  • an r10k configuration file is used to retrieve the required repository
  • a puppetfile can optionnaly be used to retrieve specific tags / commits

Here are a couple of examples based on my setup :

installation

/opt/puppetlabs/bin/puppetserver gem install r10k

NB : if no direct access is available to the rubygem repository, you can either use a proxy or perform a local install of the gem and its dependancies

r10k config file (.yaml)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

---
#--------------------------------------------------------------------------------------------------
# caching
#--------------------------------------------------------------------------------------------------
#
# controls where cached content ( such as mirrored git repositories ) are stored 
# on the local machine ( d : '~/.r10k' )

cachedir: '/var/cache/r10k'

#--------------------------------------------------------------------------------------------------
# sources
#--------------------------------------------------------------------------------------------------
#
# determines what repositories r10k will use when creating puppet environments

sources:
  %_CR_ID_%:
    remote: 'http://%_GIT_CRED_%@%_GIT_URL_%/%_CR_ID_%.git'
    basedir: '%_PATH_PUPPET_CODE_%/'
    prefix: true

#--------------------------------------------------------------------------------------------------
# deploy
#--------------------------------------------------------------------------------------------------    
#
# controls how r10k deployments behave
# the [ purge_levels ] setting controls how aggressively r10k will purge unmanaged content during a deployment

deploy:
  purge_levels: [ 'environment', 'puppetfile' ]

# the write_lock setting allows administrators to temporarily disallow r10k code deploys /!\

# write_lock: 'deploying code is currently disallowed'

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

NB : this config file is used as a base template to generate a more elaborated cfg file ( on the fly ) where all the placeholders are replaced

deployment command

/opt/puppetlabs/bin/puppetserver ruby /opt/puppetlabs/server/data/puppetserver/jruby-gems/bin/r10k deploy environment ${deployment_id} --config ${path_r10k_gen_cfg} --puppetfile --verbose debug

NB : the first r10k run can usually be really slow depending on your target repo(s) size as it needs to first populate its cache

Hope this help you get started !

edit flag offensive delete link more

Comments

thx for that. As above, our machines are isolated from the net so i grabbed the zipfile. Can you comment on https://docs.puppet.com/pe/latest/cmgmt_control_repo.html, particularly 'pe-puppet' user as of course we don't have one.

cm01 gravatar imagecm01 ( 2017-03-05 16:54:52 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2017-03-01 22:51:30 -0500

Seen: 62 times

Last updated: Mar 02