Learning CFEngine - An Automation Story

Posted by Mahesh Kumar
November 26, 2014

Hearing a user speak is worth more than self-glorification!

As we come up to year-end, it is time to start thinking about turkeys (well if you celebrate Thanksgiving like they do out here), and of course Christmas and the festive season it heralds. In this blog post I would like to thank a particular automation tool (no points for guessing which one), but really do so from the vantage point of a user and the progress they made with the tool. “Today I started learning CFEngine 3”. This was the title of an innocuous looking post from Remi on June 13’th 2013. In here he detailed his early experience attending a training session on CFEngine delivered by Diego Zamboni the author of Learning CFEngine 3. What stood out even back then and at first glance was that CFEngine is a pretty darn good monitoring tool. It is capable of fixing issues or reporting to the user.

Easy-Peasy? Maybe not. Logical and rational - Definitely Yes!

By August 2013 (less than 2 months after attending that first introduction to CFEngine class), Remi and team were well on their way. They had automated hundreds of Linux servers and setup a detailed and thorough approach to leveraging CFEngine and Git to ensure their server farm was automation. But wait CFEngine is supposed to be hard to use! It is supposed to get you all tangled up! You have to “think” CFEngine as Remi puts it. A ‘class’ in CFEngine is not what traditional OOP veterans may think it to be. And of course who doesn’t miss the if/then/else or for/while constructs. If you ask me, every programmer most likely believes that she can write an if/then/else statement to cover for all contingencies. Especially when automating systems. Yeah right! The point being, if the automation system delivers and does its job, it should not really matter whether the traditional programming constructs are present or not.

So is your automation tool automated enough?

The best analogy of CFEngine at work for me has always been the way Mark Burgess (author of Promise Theory and CFEngine) explained it: CFEngine and it’s approach to automation as he put it is analogous to the storm drain. It is there yet not something we actively worry about every waking minute. It is connected yet decentralized and autonomous. And most importantly, it is self-sufficient and knows exactly what to do when without impetus or prodding from a central master. The result - we don’t have to recourse to power tools and extensive cleanups and post mortems. The drain or the agent humbly ensures promises are kept. For the more technical amongst you Diego Zamboni in his book on CFEngine explains it thus: ‘CFEngine works on top of a theoretical model called ‘Promise Theory‘ by Mark Burgess (author of CFEngine). This theory models the behavior of autonomous agents in an environment without central authority, based on only promises of behavior made by each agent, and shows that even without central control , the system can converge to a stable state.’ convergence “Where should I go?” -Alice. “That depends on where you want to end up.” - The Cheshire Cat." It is surely about perspective when you think about automation. Should it be directed or should it be autonomic. Should there be a central dictator or mutual observation and interaction among the constituents. Should the administrator believe they are in charge of telling the tool what to do under different situations? Or should the automation approach be one based on a system working within provided constraints to establish or strive to reach ideal state. One that is self aware to take action depending on state and the dynamics of the situation. I argue that this approach which is steeped in a perspective of being self aware is far superior to any of the tools-based approaches available. Whenever you find yourself on the side of the majority, it is time to pause and reflect - Mark Twain Going back to the protagonist in our story, Remi and team automated hundreds of Linux Servers in a very short time. So impressed were they with the results that his presentation ‘Configuration Management in an Enterprise Linux Team' was subtitled ‘‘How I automated myself out of a job". You can watch a video recording of this talk at FosDem 2014. CFEngine has been around for a while. We all are familiar with other tools that have since appeared on the horizon. However not only is the CFEngine approach unique compared to the others, it also is extremely powerful, secure and scalable. All while being truly autonomous and self-healing (remember systems converge to desired state) so you the admin can focus on other important things.

Twenty years from now you will be more disappointed by the things that you didn’t do than by the ones you did do.

So where does that leave us? As you contemplate 2014 and look forward to 2015 you have a choice; at least when it comes to configuration management and systems automation technologies. Maybe you did not. Maybe your organization had already standardized on one of many tools. You can be the change agent. Try CFEngine Enterprise free. Use it on your sandbox with all of its features. And just to quell the last of the doubters, the good folks at CFEngine even have easy to use tutorials for the most common things you would want to accomplish with CFEngine. As we wind down for the year, I throw this challenge your way. Pick a few machines, download and install CFEngine, learn to use it and I guarantee you will never look back! And as for Remi who went from zero to hero in automating their entire linux server footprint in a short time, well he did not quite automate himself out of a job. Last I checked he was having fun building and managing his employers CloudStack cloud! If in 2015 you have a similar CFEngine story, we are all ears! Happy holidays ahead!

Get in touch with us
to discuss how we can help!
Contact us
Sign up for
our newsletter
By signing up, you agree to your email address being stored and used to receive newsletters about CFEngine. We use tracking in our newsletter emails to improve our marketing content.