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

  • Extending Puppet
  • Alessandro Franceschi
  • 208字
  • 2021-07-16 11:32:22

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.

主站蜘蛛池模板: 辰溪县| 阿荣旗| 格尔木市| 洛南县| 宁国市| 且末县| 堆龙德庆县| 南昌市| 巴楚县| 贡山| 香河县| 巴南区| 康乐县| 阳曲县| 元朗区| 克什克腾旗| 宜黄县| 宽甸| 铜山县| 黄石市| 滨海县| 嘉祥县| 伊川县| 如皋市| 隆安县| 怀来县| 吉木乃县| 富宁县| 达拉特旗| 长顺县| 平度市| 宁武县| 波密县| 如东县| 竹溪县| 石阡县| 筠连县| 永济市| 云和县| 安远县| 莱西市|