Satellite 6.6 Puppet & r10k

Posted on

[Work-In-Progress]

Table of contents

  • Background {#Background}
  • Version Information {#header}
  • Installing r10k {#header}

Background

The use of r10k with Satellite's packaged Puppet deployment was first documented on Using r10k with Red Hat Satellite 6. Things have changed since the post was written. For instance, the default configuration directory is no longer /etc/puppet. The new default configuration location is /etc/puppetlabs. Also, Puppet now operates out of the /opt/puppetlabs directory.

The goal of this document is to provide some guidance on how to utilize r10k with the newer version of Puppet bundled with Satellite 6.6.

Create control repo using instructions found here:
https://github.com/puppetlabs/control-repo

Version Info
This document was crafted while working with Satellite 6.6.0, gem 2.6.14.4 and r10k 3.3.3

Install r10k

/opt/puppetlabs/puppet/bin/gem install r10k

Prepare directories

mkdir -p {/etc/puppetlabs/code/environments_r10k,/etc/puppetlabs/r10k/.ssh}

Generate key-pair

ssh-keygen -t rsa -b 4096 -C "root@server.name.domain"
  Enter file in which to save the key (/root/.ssh/id_rsa): /etc/puppetlabs/r10k/.ssh/id_rsa
  Enter passphrase (empty for no passphrase):
  Enter same passphrase again:

SSH config on Satellite server
Add the following content to /root/.ssh/config

 HostName git.server.name
 IdentityFile /etc/puppetlabs/r10k/.ssh/id_rsa
 User git

Configure r10k
Add the following content to /etc/puppetlabs/r10k/r10k.pp

# The location to use for storing cached Git repos
:cachedir: '/var/cache/r10k'

# A list of git repositories to create
:sources:
  # This will clone the git repository and instantiate an environment per
  # branch in /etc/puppetlabs/code/environments
  :org1:
    remote: 'git@git.server.name:puppet/control-repo1.git'
    basedir: '/etc/puppetlabs/code/environments_r10k'
  :org2:
    remote: 'git@git.server.name:puppet/control-repo2.git'
    basedir: '/etc/puppetlabs/code/environments_r10k'