Skip to content

Instantly share code, notes, and snippets.

@adamgoucher
Created July 31, 2015 01:53
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 adamgoucher/07e1a774b43619305139 to your computer and use it in GitHub Desktop.
Save adamgoucher/07e1a774b43619305139 to your computer and use it in GitHub Desktop.
So puppet lets you assign agents to 'environments', but that is done at the agent level. But of course you cannot manage the agent config until it has connected to the server to gets its node config blah blah blah catch 22. so i'm going to modify /etc/default/puppet to look like this in my custom ami in order to be able to pass in the environmen…
# Defaults for puppet - sourced by /etc/init.d/puppet
# Enable puppet agent service?
# Setting this to "yes" allows the puppet agent service to run.
# Setting this to "no" keeps the puppet agent service from running.
START=yes
for x in $(facter ec2_userdata); do
case $x in
puppet_environment*)
PUPPET_ENVIRONMENT=$(echo $x | cut -d= -f2)
;;
esac
done
# Startup options
if [ -n "$PUPPET_ENVIRONMENT" ]; then
DAEMON_OPTS="--environment=$PUPPET_ENVIRONMENT"
else
DAEMON_OPTS=""
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment