Operations | Monitoring | ITSM | DevOps | Cloud

CFEngine

Feature Friday #22: Don't fix, just warn

Did you know that CFEngine can simply warn about something not being in the desired state? Traditionally with CFEngine, you define your desired state and CFEngine works towards making that happen. Sometimes you might not want CFEngine to take action and instead warn that a given promise wants to change something. Let’s take a look at a contrived example.

Feature Friday #21: Promisees or stakeholders

Who cares about that promise? Today, I want to highlight one of the lightweight knowledge management features in CFEngine. That is, Promisees, also known as Stakeholders. Promisees are references to things that might care about a specific promise. And they can be attached to any promise. Let’s take a look at a contrived example: From the example above, we can see that the methods promise - promising to run the example_promisees bundle - has Feature Friday #21 defined as the only promisee.

Feature Friday Feature Friday #20: Macros

Did you know CFEngine has Macros? They were first introduced in CFEngine 3.7 (back in 2015), and more have been introduced since then. Macros are convenient for preventing the parsing of a section of the policy. It is handy for protecting older binaries from getting tripped up on newer syntax the agent does not understand. Let’s take a look. Currently there are 8 macros. You can find examples of use within the Masterfiles Policy Framework.

CFEngine 3.24 LTS released - Consistency

Today, we are pleased to announce the release of CFEngine 3.24.0! The code word for this release is consistency. This release also marks an important event, the beginning of the 3.24 LTS series, which will be supported for 3 years. Several new features have been added since the release of CFEngine 3.21 LTS, in the form of non-LTS releases.

Feature Friday #19: What variables and classes are defined?

Do you know how to quickly see what variables and classes are defined? Often, while developing CFEngine policy it’s convenient to emit a variable value or a report based on the presence of a class. For example: In some cases, this is because you are exploring what classes are available. In other cases, it might be DEBUG-related reports helping you understand how a variable is resolved during policy evaluation.

Feature Friday #18: Augments - def.json

Ever want to get some data into CFEngine? Have you heard about the def.json Augments file?1 Augments are JSON data files that allow you to define classes and variables very early during agent initialization, before policy. Augments are practical in a variety of ways. Perhaps most notably for overriding policy defaults. Let’s look at a simple example.

Feature Friday #17: Tags for inventory and reporting

Let’s talk about tags and how they can be useful for Inventory and Reporting. If you have been following along with the Feature Friday series you already heard about using tags to find currently defined classes, variables and bundles, but they are also very useful for reporting. In CFEngine Enterprise the inventory and attribute_name tags are special. A variable or class tagged with inventory becomes visible in the Inventory subsystem in Mission Portal with the name given in the attribute_name tag.

Install and uninstall packages based on conditions

For security reasons, you generally want to uninstall talk, samba, and apache2 in your infrastructure. However, on your webservers, which have the webserver CFEngine class defined, you might want Apache to be installed. With the conditional-installer module, you can put talk,samba,apache2 in the list of packages to uninstall. And in the list of packages to install, you can put apache2 with the condition webserver. Hence, the module will install apache2 on your webservers and uninstall it everywhere else.

Feature Friday #16: host info report

Did you know the Masterfiles Policy Framework (MPF) ships with a host info report? That’s right, you can simply run cf-agent --bundlesequence host_info_report and a report will be generated. command output It’s packed with information about the specific host. Let’s peek: command output Here are the section headers: command output Running with the show_software class defined will add information about installed packages command output command output Happy Friday!