Using Hiera as an ENC
Hiera provides an interesting function called hiera_include
, which allows users to include all the classes defined for a given key.
This, in practice, exploits the Hiera flexibility to provide classes to nodes as an External Node Classifier does.
It's enough to place the following line in our site.pp
file at /etc/puppet/manifests/
:
hiera_include('classes')
Define in our data sources a classes
key with an array of the classes to be included.
In a YAML-based backend, it would look like the following:
--- classes: - apache - mysql - php
This is exactly the same as having some declarations in our site.pp
as follows:
include apache include mysql include php
The classes
key (can have any name, but classes
is a standard de facto) contains ...
Get Extending Puppet now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.