Main manifest directory

Puppet starts compiling a catalog either with a single manifest file or with a directory of manifests that are treated like a single file. This starting point is called the main manifest or site manifest.

For more information about how the site manifest is used in catalog compilation, see Catalog compilation.

Specifying the manifest for Puppet apply

The puppet apply command uses the manifest you pass to it as an argument on the command line:

puppet apply /etc/puppetlabs/code/environments/production/manifests/site.pp

You can pass Puppet apply either a single .pp file or a directory of .pp files. Puppet apply uses the manifest you pass it, not an environment's manifest.

Specifying the manifest for Puppet master

Puppet master uses the main manifest set by the current node's environment, whether that manifest is a single file or a directory of .pp files.

By default, the main manifest for an environment is <ENVIRONMENTS DIRECTORY>/<ENVIRONMENT>/manifests, for example /etc/puppetlabs/code/environments/production/manifests. You can configure the manifest per-environment, and you can also configure the default for all environments.

To determine its main manifest, an environment uses the manifest setting in environment.conf. This can be an absolute path or a path relative to the environment’s main directory.

If the environment.confmanifest setting is absent, it uses the value of the default_manifest setting from the puppet.conf file. The default_manifest setting defaults to ./manifests. Similar to the environment's manifest setting, the value of default_manifest can be an absolute path or a path relative to the environment’s main directory.

To force all environments to ignore their own manifest setting and use the default_manifest setting instead, set disable_per_environment_manifest = true in puppet.conf.

To check which manifest your Puppet master uses for a given environment, run:
puppet config print manifest --section master --environment <ENVIRONMENT>

For more information, see Creating environments, and Checking values of configuration settings.

Manifest directory behavior

When the main manifest is a directory, Puppet parses every .pp file in the directory in alphabetical order and evaluates the combined manifest. It descends into all subdirectories of the manifest directory and loads files in depth-first order. For example, if the manifest directory contains a directory named 01, and a file named 02.pp, it parses the files in 01 before it parses 02.pp.

Puppet treats the directory as one manifest, so, for example, a variable assigned in the file 01_all_nodes.pp is accessible in node_web01.pp.