ENC output format
An ENC must return either nothing or a YAML hash to
standard out. The hash must contain at least one of classes
or parameters
, or it
can contain both. It can also optionally contain an environment
key.
ENCs exit with an exit code of 0 when functioning normally, and can exit with a non-zero exit code if you want Puppet to behave as though the requested node was not found.
If an ENC returns nothing or exits with a non-zero exit code, the catalog compilation fails with a “could not find node” error, and the node is unable to retrieve configurations.
For information about the YAML format, see yaml.org.
Classes
If present, the value of classes
must be either an array of class names or a hash whose keys
are class names. That is, the following are
equivalent:
classes: - common - puppet - dns - ntp classes: common: puppet: dns: ntp:
If you're specifying parameterized classes, use the hash key
syntax, not the array syntax. The value for a parameterized class is a hash of the
class’s parameters and values. Each value can be a string, number, array, or hash.
Put string values in quotation marks, because YAML parsers sometimes treat certain
unquoted strings (such as on
) as
Booleans. Non-parameterized classes can have empty
values.
classes: common: puppet: ntp: ntpserver: 0.pool.ntp.org aptsetup: additional_apt_repos: - deb localrepo.example.com/ubuntu lucid production - deb localrepo.example.com/ubuntu lucid vendor
Parameters
If present, the value of the parameters
key must be a hash of valid variable names and associated
values; these are exposed to the compiler as top-scope variables. Each value can be
a string, number, array, or
hash.
parameters: ntp_servers: - 0.pool.ntp.org - ntp.example.com mail_server: mail.example.com iburst: true
Environment
If present, the value of environment
must be a string representing the desired environment for this node. This is the only environment used by the node
in its requests for catalogs and
files.
environment: production
Complete example
--- classes: common: puppet: ntp: ntpserver: 0.pool.ntp.org aptsetup: additional_apt_repos: - deb localrepo.example.com/ubuntu lucid production - deb localrepo.example.com/ubuntu lucid vendor parameters: ntp_servers: - 0.pool.ntp.org - ntp.example.com mail_server: mail.example.com iburst: true environment: production