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

Roles and Profiles

The roles and profiles pattern became common knowledge in the Puppet community following Craig Dunn's seminal blog post (https://www.craigdunn.org/2012/05/239/), and has been rapidly taken up by the rest of the community. It's now a widely adopted pattern or best practice. It's a reliable way to build reusable, configurable, and refactorable site-wide configuration code, and it's an approach to dealing with the interfaces of your infrastructure—using the software development paradigms of encapsulation and abstraction.

Before the pattern developed, the Puppet language itself provided just two levels of abstraction, as follows:

But it soon became clear that further intermediate abstraction was needed to break up, restructure, and clarify these two.

Let's consider the overarching task: we want to assign classes (and their corresponding business data) to nodes, and we want to do this in a way that encapsulates and hides complexity away at each stage of this abstraction process: moving from looking at the node in its context within the whole infrastructure, as a software stack, and drilling down into the technology components and their configuration, which comprise elements of that software stack.

I've seen nodes being defined in the very long-hand way, using only these two levels of abstraction. I've also seen other approaches, such as using a Hiera-based micro external node classifier (ENC). I've helped to transition companies to using the roles and profiles pattern, and I've used both the Puppet Enterprise console and Foreman as ENC. I've defined nodes in Puppet code, using Hiera in many ways to assist node classification, and I've even used the PE console API for node classification, so I hope I've picked up a few best practices along the way that I can now pass along to you.

In this chapter, let's look together at the roles and profiles pattern, and how this can help you to manage your infrastructure professionally and achieve our next milestone in Mastering Puppet 5.

主站蜘蛛池模板: 黔西县| 通榆县| 东安县| 长岭县| 文安县| 新营市| 德格县| 安徽省| 扎赉特旗| 厦门市| 阿克苏市| 岳池县| 黑龙江省| 克什克腾旗| 同仁县| 昌都县| 进贤县| 双江| 花垣县| 刚察县| 当涂县| 福清市| 遵义市| 定边县| 和静县| 河津市| 泌阳县| 襄城县| 万年县| 保山市| 玛沁县| 息烽县| 陆川县| 通城县| 当涂县| 武义县| 常宁市| 象州县| 威海市| 泰顺县| 张家港市|