{"id":3451,"date":"2016-04-19T16:14:12","date_gmt":"2016-04-19T15:14:12","guid":{"rendered":"https:\/\/www.devco.net\/?p=3451"},"modified":"2016-04-19T21:21:35","modified_gmt":"2016-04-19T20:21:35","slug":"hiera-node-classifier-0-7","status":"publish","type":"post","link":"https:\/\/www.devco.net\/archives\/2016\/04\/19\/hiera-node-classifier-0-7.php","title":{"rendered":"Hiera Node Classifier 0.7"},"content":{"rendered":"

A while ago I released a Puppet 4 Hiera based node classifier<\/a> to see what is next for hiera_include()<\/em>. This had the major drawback that you couldn’t set an environment with it like with a real ENC since Puppet just doesn’t have that feature.<\/p>\n

I’ve released a update to the classifier that now include a small real ENC that takes care of setting the environment based on certname and then boots up the classifier on the node.<\/p>\n

Usage<\/H2>
\nENCs tend to know only about the certname, you could imagine getting most recent seen facts from PuppetDB etc but I do not really want to assume things about peoples infrastructure. So for now this sticks to supporting classification based on certname only.<\/p>\n

It’s really pretty simple, lets assume you are wanting to classify node1.example.net<\/em>, you just need to have a node1.example.net.yaml<\/em> (or JSON) file somewhere in a path. Typically this is going to be in a directory environment somewhere but could of course also be a site wide hiera directory.<\/p>\n

In it you put:<\/p>\n

\r\nclassifier::environment: development\r\n<\/pre>\n

And this will node will form part of that environment. Past that everything in the previous post<\/a> just applies so you make rules or assign classes as normal, and while doing so you have full access to node facts.<\/p>\n

The classifier now expose some extra information to help you determine if the ENC is in use and based on what file it’s classifying the node:<\/p>\n