Have you ever wanted some hosts to organize themselves into different groups, but without spending time to worry about assigning a specific group?
Cody, Craig, and Nick talk about using the select_class feature in CFEngine. Nick implements automatic assignment of a maintainer for each host:
You want to assign a maintainer to each host that should be the primary point of contact. Some hosts should may have a specific maintainer, but generally, you don’t care about the relationship between the person and the actual function of the machine. It’s okay if the groups are not perfectly balanced. First we provide a list of maintainers to select from.
Ever wanted to manipulate a string - temporarily - for an individual promise? Check out the with attribute and its special, $(with) variable.
Sometimes you need some variation on a string for a specific case. Traditionally, to achieve this you’d simply define another variable.
Here is a contrived example:
I have a string, nginx and I want to emit a report that contains both the string itself and the upper case version of the string.
Looking for a way to concisely set a variable conditionally? Have you heard of ifelse()?
In CFEngine, traditionally class expressions are used to constrain promises to different contexts. Setting a variable to different values based on context might look like this:
/tmp/feature-friday-1.cf bundle agent __main__ { vars: "MyVariable" string => "My Default value"; redhat_8|centos_8|rocky_8:: "MyVariable" string => "My value for EL 8"; ubuntu_22:: "MyVariable" string => "My value for Ubuntu 22"; any:: "MyVariable" string => "My value on Friday", if => "Friday"; reports: "It's $(sys.date) and I am running on $(sys.os_release[PRETTY_NAME])"; "MyVariable is '$(MyVariable)'"; } command cf-agent --no-lock --log-level info --file /tmp/feature-friday-1.cf output R: It's Mon Mar 11 12:36:41 2024 and I am running on Ubuntu 22.04.4 LTS R: MyVariable is 'My value for Ubuntu 22' That’s great, lots of flexibility, but with an increasing number of options the policy can get quite long and it’s easier for a human interpreter to lose track of the context. The same can be achieved in a single statement using ifelse().
Last year in commemoration of 30 years of CFEngine I received this lovely coin.
I thought it would be fun to celebrate by writing 42 blog posts, each with some little tip about CFEngine. So, be sure to come check in on Friday for the first post in the Feature Friday series.
Series Posts ifelse() $(with) execresult_as_data() cf-remote cfbs cf-promises depends_on –bundlesequence body file control - inputs cf-support namespaces special variables classesmatching() variablesmatching() & variablesmatching_as_data() bundlesmatching() host info report Tags for Inventory and Reporting Augments - def.json What variables and classes are defined? Macros Promisees or Stakeholdes Don’t fix, just warn Agent say! Augments - host_specific.json Unprivileged execution Groups custom promise type Multiple outcomes Restricting individual promises using if and unless Variable class expressions Agent svg Seeing a data structure with storejson() Doing math in policy with eval() Why associative arrays when data containers exist? Self organizing groups Groups in Mission Portal Formatting policy with cffmt Decisions based on arbitrary semantic versions Developing modules that take input The power of lists and implicit iteration What would CFEngine do? How can I quote thee, let me count the ways ob-cfengine3
Curious about getting visibility of a host where you can’t install CFEngine natively, but can run a container?
Craig shows us how he’s getting inventory from his Torizon Verdin IMX8MP by deploying a container with a chroot containing volumes bind mounted from the host.
A long post show discussion was had about CfgMgmtCamp as well as a long troubleshooting session dealing with a prickly package management situation.
Video The video recording is available on YouTube:
The CFEngine team celebrates 30 years of CFEngine and has a chat with Mark Burgess, the original creator and author of CFEngine.
Mark delves into the early chapters of his journey, tracing back the roots of his inspiration to science fiction sagas like Star Trek and Dr. Who, and the literary works of Isaac Asimov, Aurthur C. Clarke, and Paul Davies. Mark recalled his first computer, the fabulous, most programmable, decomposable, put back together-able, expandable thing, a BBC-b microcomputer.
When executing commands in a shell, the program and its arguments are typically separated by spaces. This command reads the content of two files and prints it out (concatenating it):
command cat one.txt two.txt In the example above, cat is the command / program, while one.txt is the first argument, and two.txt is the second argument. This is great because it makes commands really easy to read and type, however there is one obvious drawback: When a space has a special meaning (separating arguments), what do you do when you actually need a space?
We are pleased to announce two new patch releases for CFEngine, version 3.18.7 and 3.21.4! These patch releases contain bug fixes and dependency updates.
Changes We’d like to highlight one specific change in behavior, which some users will want to adjust to;
Change in behavior - New location for ignore_interfaces.rx Users who rely on the ignore_interfaces.rx file for ignoring certain network interfaces should be aware of its new preferred location. See the blog post on the topic for more details:
As we bid farewell to 2023, it’s once again time to reflect on the milestones and progress we’ve made throughout the year. This year is especially significant because it marks 30 years since CFEngine’s birth. From its humble beginnings at the University of Oslo to the thousands of implementations across the world and counting, CFEngine has not only weathered the twists and turns of life, but has thrived in an industry where many have come and gone.
Curious about how users feel about using CFEngine?
Cody and Nick are joined by Mike Weilgart, a long time CFEngine user about his history and how CFEngine compares to other tools he has been using recently.
Video The video recording is available on YouTube:
At the end of every webinar, we stop the recording for a nice and relaxed, off-the-record chat with attendees. Join the next webinar to not miss this discussion.