Puppet always starts compiling with either a single manifest file or a directory of manifests that get treated like a single file. This main starting point is called the main manifest or site manifest.
For more information on how the site manifest is used in catalog compilation, see the reference page on catalog compilation.
With Puppet Apply
puppet apply command requires a manifest as an argument on the command line. (For example:
puppet apply /etc/puppetlabs/puppet/manifests/site.pp.) It may be a single file or a directory of files.
Puppet apply does not use the
manifest setting or environment-specific manifests; it always uses the manifest given on the CLI.
With Puppet Master
The location of the main manifest depends on how Puppet is configured. See the sections below for details.
To check the actual manifest your Puppet master will use for a given environment, run
puppet config print manifest --section master --environment <ENVIRONMENT>.
The main manifest may be a single file or a directory of
manifest setting in environment.conf, the value of
default_manifest can be an absolute or relative path. If it’s a relative path, Puppet will resolve it relative to each environment’s main directory.
Since the default value of
./manifests, the default main manifest for a directory environment is
<ENVIRONMENTS DIRECTORY>/<ENVIRONMENT NAME>/manifests. (For example:
For more details, see:
No Environments, or Config File Environments
If you haven’t enabled directory environments, Puppet will use the value of the
manifest setting in
puppet.conf as its main manifest. Note that setting
manifest in puppet.conf is deprecated, and will not be possible in Puppet 4.0.
manifest setting defaults to
$confdir/manifests/site.pp, which is a single file. (See the confdir documentation for more about the confdir.)
Directory Behavior (vs. Single File)
If the main manifest is a directory, Puppet will parse every
.pp file in the directory in alphabetical order and then evaluate the combined manifest.
Puppet will act as though the whole directory were just one big manifest; for example, a variable assigned in the file
01_all_nodes.pp would be accessible in
- If the
parsersetting is set to
current, Puppet will only read the first level of files in a manifest directory; it won’t descend into subdirectories.
If you’ve set
parser = future, Puppet will descend into all subdirectories of the manifest dir.
Puppet will load files in depth-first order. (For example, if the manifest directory contains a directory named
01and a file named
02.pp, it will parse all the files in
Recommended: If you’re using the main manifest heavily instead of relying on an ENC, consider changing the
$confdir/manifests. This lets you split up your top-level code into multiple files while avoiding the
importkeyword. It will also match the behavior of directory environments.