Skip to content

Instantly share code, notes, and snippets.

@todgru
Created July 20, 2016 16:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save todgru/0b55c335b01a5c6c268f574b0178dc6c to your computer and use it in GitHub Desktop.
Save todgru/0b55c335b01a5c6c268f574b0178dc6c to your computer and use it in GitHub Desktop.
HOWTO configure the puppet enterprise master (v3.7) to use environment directories

Overview

This document describes how to modify the Puppet Master (Enterprise v3.7) server configuration so that it can use environments for the manifests. Using those environment files allows the puppet agents to configure themselves in a variety of environments. It allows you to create a separate set of manifests and modules for specific environments, thereby safeguarding that untested modifications to no promote to the production nodes.

Setup environment directories

$ cd /etc/puppetlabs
$ sudo mkdir environments
$ sudo clown -r puppet:root environments

Clone the github repos into separate environments. production environment will always used a stable, tagged version. All other environments can be modified at will

$ cd /etc/puppetlabs/environments
$ git clone git@github.com:Chirpify/puppet.git development
$ git clone git@github.com:Chirpify/puppet.git production

Create or copy the manifests into the directories

$ mkdir -p /etc/puppetlabs/environments/production/manifests
$ mkdir -p /etc/puppetlabs/environments/development/manifests

Since we have 'staging_{color}' environments, we need to create directories for those. Thankfully puppet accepts symlinks

$ ln -s /etc/puppetlabs/environments/development /etc/puppetlabs/environments/staging_red
$ ln -s /etc/puppetlabs/environments/development /etc/puppetlabs/environments/staging_blue

$ ln -s /etc/puppetlabs/environments/development /etc/puppetlabs/environments/staging
$ ln -s /etc/puppetlabs/environments/development /etc/puppetlabs/environments/marriott_test

Enable Environment-based

IN /etc/puppetlabs/puppet/puppet.conf ensure in the [main] section that you have set the following configuration values:

[main]
	environmentpath = /etc/puppetlabs/environments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment