Using an external node classifier
When Puppet runs on a node, it needs to know which classes should be applied to that node. For example, if it is a web server node, it might need to include an apache
class. The normal way to map nodes to classes is in the Puppet manifest itself, for example, in your site.pp
file:
node 'web1' { include apache }
Alternatively, you can use an External Node Classifier (ENC) to do this job. An ENC is any executable program that can accept the fully-qualified domain name (FQDN) as the first command-line argument ($1
). The script is expected to return a list of classes, parameters, and an optional environment to apply to the node. The output is expected to be in the standard YAML format. When using an ENC, you should keep in mind that the classes applied through the standard site.pp
manifest are merged with those provided by the ENC.
Note
Parameters returned by the ENC are available as top-scope variables to the node.
An ENC could be a simple shell script...