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

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.

主站蜘蛛池模板: 宜兴市| 东宁县| 莫力| 清水县| 舞钢市| 乐东| 泰顺县| 莱芜市| 若尔盖县| 望都县| 聊城市| 海口市| 绥阳县| 花莲市| 津南区| 庆安县| 林州市| 日照市| 禹州市| 获嘉县| 巩义市| 从江县| 武强县| 乌审旗| 通化县| 上虞市| 侯马市| 科技| 洛南县| 科技| 扶沟县| 锡林郭勒盟| 兴海县| 江门市| 金门县| 长治县| 金阳县| 施秉县| 开鲁县| 河源市| 称多县|