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

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.

主站蜘蛛池模板: 平江县| 巴青县| 文山县| 大渡口区| 中卫市| 龙泉市| 南乐县| 临武县| 南雄市| 万州区| 苍溪县| 金华市| 景德镇市| 德清县| 兴城市| 五家渠市| 天柱县| 方城县| 达拉特旗| 刚察县| 沾化县| 克山县| 内丘县| 名山县| 辽阳市| 南岸区| 福泉市| 青冈县| 崇左市| 南安市| 绿春县| 阿合奇县| 凤台县| 娄底市| 怀柔区| 沾化县| 晋宁县| 于田县| 霞浦县| 衡阳市| 哈巴河县|