官术网_书友最值得收藏!

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 an array that is merged along the hierarchy. So we can define in a common.yaml file the classes that we want to include in all our nodes, and include specific classes for specific servers, adding them to the different layers of our hierarchy.

Along with the hiera-file backend, this function can help us have a fully Hiera-driven configuration on our Puppet architecture. It is one of the many options we have that will help us glue together the pieces that define and build our infrastructure.

主站蜘蛛池模板: 滨海县| 桐庐县| 滨海县| 巴马| 巴塘县| 曲阳县| 平泉县| 阜阳市| 阿拉善左旗| 宁海县| 中方县| 玉溪市| 清苑县| 阳江市| 连云港市| 大英县| 金乡县| 庄浪县| 顺昌县| 石狮市| 万山特区| 昌黎县| 塘沽区| 镶黄旗| 顺平县| 台中县| 合作市| 庐江县| 海口市| 四平市| 乌兰浩特市| 海宁市| 新营市| 沾化县| 杂多县| 东方市| 天镇县| 桂平市| 汝州市| 宾阳县| 吴桥县|