Skip to content

Latest commit

 

History

History
74 lines (56 loc) · 4.23 KB

R10k.md

File metadata and controls

74 lines (56 loc) · 4.23 KB

This is an updated version of Satellite 6.6 Puppet & r10k to support the latest version of Red Hat Satellite (6.12+). While the Puppet features are no longer enabled by default, they are still available.

In earlier version of Satellite, Pulp was able to synchronize the Puppet modules to each of the Capsule servers. However, when Pulp 4 was released, that feature was lost. R10k is a pre-existing application that is capable of replacing that missing functionality and synchronize the Puppet modules from a git repo to each of the Capsule servers.

PuppetLab releases a module that can manage R10k, however, you need to initiate the process before it will become self-managing. This can be accomplished by manually completing a couple of the tasks that would normally be done by the module.

  1. Ensure your branch names are based on your environment steps. This will typically mean renaming the main branch to production

  2. Add puppet-r10k to the Puppetfile within your git repo

    Within your git repo, make sure there is a file named Puppetfile in the root and add the following line

    mod 'puppet-r10k', :latest
    
  3. Install R10k on the Satellite server

    puppetserver gem install r10k

    WARNING
    Do not use gem install r10k. This will break Satellite as R10k depends on newer version of gems than what Satellite uses. Using puppetserver gem will use the version of gem that is included with the puppet server and will keep Satellite from seeing the gems. This is similar to how system Python modules are stored separately from the global module store.

  4. Configure the r10k client by writing the following content to /etc/puppetlabs/r10k/r10k.yaml

    ---
    :cachedir: /opt/puppetlabs/puppet/cache/r10k
    :sources:
    *source_name*:
        basedir: /etc/puppetlabs/code/environments
        remote: *git_url*
    
    :pool_size: 16
    

    *source_name* is an arbitrary identifier for the source
    *git_url* is the url of your git repo. If you are syncing over ssh, the ssh key will be stored in the root user's account

  5. Run the initial sync as root

    /opt/puppetlabs/puppet/bin/r10k deploy environment -p
  6. Configure the R10k module within Satellite

    1. Connect to the Satellite web interface and browse to Configure -> Classes
    2. Click Import environment from *satellite_server*
    3. Select the environment that contains the r10k module and click Import
    4. Click on r10k in the list of classes
    5. Select the Smart Class Paramter tab
    6. Select the parameter include prerun command, check Override, and set the Default Value to true
    7. Select the parameter sources, check Override, and set the Default Value to the following:
      *source_name*:
          remote: *git_url*
          basedir: "/etc/puppetlabs/code/environments"
      *source_name* is an arbitrary identifier for the source
      *git_url* is the url of your git repo. If you are syncing over ssh, the ssh key will be stored in the root user's account
    8. Click Submit
  7. Assign the class to the Satellite server and Capsule

    1. Connect to the Satellite web interface and browse to Configure -> Host Groups
    2. If you do not already have a Host Group for your Satellite and Capsule servers, it is recommended to create one now
    3. Click on the Host Group for your Satellite and Capsule servers
    4. Select the Puppet ENC tab
    5. Expand the r10k module and click on the r10k class to assign it to the Host Group
    6. Click Submit
  8. You can now either wait up to 30 minutes for the Puppet agent to automatically run or run the command puppet agent -t on the Satellite server and Capsule servers to cause Puppet to run immediately.

As long as the Capsule servers are using the Satellite server as their Puppet Master, these tasks only need to be completed on the Satellite server. If the Capsule servers are using themselves as their Puppet Master, steps 3-5 will need to be run on the Capsule servers as well