Create a new environment
By default a barebones environment called ‘production’ is installed by the server package. Unconfigured agents will try to apply the ‘production’ environment by default. It’s therefore a good idea to leave it empty so that you don’t accidentally apply configurations to a new agent.
-
Create a new directory in ‘/etc/puppetlabs/code/environments’ for your environment and give your user read/write access to it
sudo mkdir /etc/puppetlabs/code/environments/test
sudo chown sysadm.users /etc/puppetlabs/code/environments/test
- Create an empty Git repository in the new environment
cd /etc/puppetlabs/code/environments/test
git init
- Copy the barebones ‘production’ environment’s contents
cp -a ../production/* .
-
Add the new files to git, and commit the changes
git add .
git commit -m "New empty environment"
-
Apply the environment to our server
sudo /opt/puppetlabs/bin/puppet agent --verbose --onetime --no-daemonize --server workshop.vm --environment test