The codedir is the main directory for Puppet code and data. It is used by Puppet master and Puppet apply, but not by Puppet agent. It contains environments (which contain your manifests and modules), a global modules directory for all environments, and your Hiera data and configuration.
*nix non-root users:
When Puppet is running as root, as a Windows user with administrator privileges, or as the
puppet user, it uses a system-wide codedir. When running as a non-root user, it uses a codedir in that user's home directory.
When running Puppet commands and services as
puppet, you should usually use the system codedir. To use the same codedir as the Puppet agent, or Puppet master, run admin commands such as
puppet module with
codedirsetting in your
puppet.conffile, such as:
codedir = /etc/puppetlabs/code
puppet.conf, and instead uses the
puppetserver.conf. When using a non-default codedir, you must change both settings.
puppet.confsettings by using the
$codedirvariable in the value. For example, the
$codedirvariable is used as part of the value for the
[master] environmentpath = $codedir/override_environments:$codedir/environments
This allows you to avoid absolute paths in your settings and keep your Puppet-related files together.
The codedir contains environments, including manifests and modules, a global modules directory for all environments, and Hiera data.