Code and data directory (codedir)
Included in Puppet Enterprise 2017.1.
codedir is the main directory for Puppet code and data. It contains environments (which contain your manifests and modules), a global modules directory for all environments, and your Hiera data.
Puppet’s codedir can be found at one of the following locations:
- *nix Systems:
- non-root users:
When Puppet is running as either root, a Windows user with administrator privileges, or the
puppet user, it will use a system-wide codedir. When running as a non-root user, it will use a codedir in that user’s home directory.
The system codedir is what you usually want to use, since you will usually run Puppet’s commands and services as root or
puppet. (Note that admin commands like
puppet module must be run with
sudo to use the same codedir as Puppet agent or Puppet master.)
Note: When Puppet master is running as a Rack application, the
config.rufile must explicitly set
--codedirto the system codedir. The example
config.rufile provided with the Puppet source does this.
The location of the codedir can be configured in puppet.conf with the
codedir setting, but note that Puppet Server doesn’t use that setting; it has its own
jruby-puppet.master-code-dir setting in puppetserver.conf. If you’re using a non-default codedir, you must change both settings.
Since the value of the codedir is discovered before other settings, you can safely reference it (with the
$codedir variable) in the value of any other setting in puppet.conf:
[master] environmentpath = $codedir/override_environments:$codedir/environments
If you need to set nonstandard values for some settings, this allows you to avoid absolute paths and keep your Puppet-related files together.
Puppet’s codedir contains environments, modules, and Hiera data. Its contents are used by Puppet master and Puppet apply, but not by Puppet agent.
Almost everything in the codedir has its own page of documentation.