Claus-Theodor Riegg
6 years
Claus-Theodor Riegg
7 years
Claus-Theodor Riegg
7 years
Claus-Theodor Riegg
7 years
Claus-Theodor Riegg
7 years
Claus-Theodor Riegg
8 years
Claus-Theodor Riegg
8 years
Claus-Theodor Riegg
8 years

HowTo: let puppet agent run from different branch

Posted About 5 years ago. Visible to the public.

This is not encouraged because this change is easily forgotten. We recommend using this only if you know what you are doing.

Should you be in need to run puppet from a branch (called environment in puppet land) other than production for a long time and can't or don't want to disable puppet you can do the following:

Add a new section to /etc/puppetlabs/puppet/puppet.conf on the server that should apply the environment. It usually looks like this:

[main]
< some stuff >

Add the agent section so it looks like this:

[main]
< some stuff >

[agent]
environment = $environment_name

If you put the environment line below the main section, you might get the following error:

/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/environments.rb:38:in `get!': Could not find a directory environment named '$environment_name' anywhere in the path: /etc/puppetlabs/code/environments. Does the directory exist? (Puppet::Environments::EnvironmentNotFound)
	from /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application_support.rb:34:in `push_application_context'
	from /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application.rb:363:in `run'
	from /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/command_line.rb:132:in `run'
	from /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/command_line.rb:72:in `execute'
	from /usr/bin/puppet:5:in `<main>'

Configure a different environment in hiera

For some longer testing of feature branches the environment setting can be set in hiera. All changes from the environment can be easily undone with pate production.

lookup_options:
  makandra::puppet_agent::config:
    merge: deep
makandra::puppet_agent::config:
  agent:
    environment: staging_lb

Put this change into a single commit and mark it with [#00000] NOMERGE.

Maintain this feature branch on a regular basis to not get too far behind production.

Setup a reminder to either merge the branch or drop it.

Inform the colleagues about the different environment.

Last edit
Over 1 year ago
Moritz Kraus
Tags
License
Source code in this card is licensed under the MIT License.