Placing code on the Puppet server
From a technical perspective, roles and profiles are classes inside modules. Usually, modules are put into the modules
directory of an environment. But roles and profiles are different to modules, as they are implementations of modules and collections of implementations.
To reflect this different behavior, it is common practice to add another module
directory to an environment. This configuration can be done in the environment.conf
file inside an environment:
#/etc/puppetlabs/code/environments/production/environment.conf modulepath = site:modules:$basemodulepath
Within our example, we have added a new path to the module path setting: site. This directory resides inside our environment (/etc/puppetlabs/code/environments/production/site
). This directory will have all of our roles and profiles:
/etc/puppetlabs/code/environment/production/site/ |- profile/ | |- manifests/ | | |- apps/ | | | |- phpmyadmin/ | | | | \- db.pp | | | \- phpmyadmin.pp | ...