Creating a puppet environment
Creating a new environment for development or production. Dividing these two is important. Don´t update or reconfigure a node, module or most important your puppetmaster/puppet agent before you are sure it will not affect the current production environment. So test before implement.
Firstly decide what your new environment should be named and make a folder structure. I have decided to call mine ”development”. Mostly because I would like to follow my own words and have a development environment to test and play with that do not effect current working nodes
Allowed Environment Names
Environment names can contain lowercase letters, numbers, and underscores. That is, they must match the following regular expression:
\A[a-z0-9_]+\Z
- environments
- development
- manifest
- modules
- development
Commands:
Tell puppet where the environments are located and add this to main section in the puppet.conf
environmentpath=/etc/puppet/environments
sudo mkdir -p /etc/puppt/environments/development/manifest
sudo mkdir -p /etc/puppt/environments/development/modules
Enviroment.conf which can locally override several settings, including modulepath
and manifest
.
sudo touch /etc/puppet/environments/development/environement.conf
Edit the file and add
[main]
manifest = $confdir/environments/development/manifests
modulepath = $confdir/environments/development/modules
Test that is working with:
sudo puppet config print modulepath –section master –environment development
Great it works
Now to install a module into the environments
No installed moduels
As a test I will install a standard puppetlabs module — stdlib.
puppet module install puppetlabs-stdlib –environment development
And if I do a puppet module list again on the development environment I can see that it is installed
As for the default environment
Notice the puppetlabs-stdlib module at the bottom. The version is different from the one we installed in the development environment.
So how to can a client see the different between the development and the default environment?
Lets take a look on that in a future post