Learning Chef – where to start?

Over the last six months or so, I’ve had the opportunity to learn Chef, and have worked through a number of training resources, to the point that I am now developing cookbooks for general consumption. This was the first of the ‘big three’ Configuration Management tools that I put decent amount of time into, followed by some work with Ansible a couple of months ago.

While the need for Configuration Management tools like these is somewhat diminishing with the growth of cloud-native applications, and containers, there is still a serious amount of infrastructure which can benefit from such tools, and the time to pick up and learn one of these has never been better.

So in this post I wanted to talk about some of the resources I found really useful when working through the various products in the Chef portfolio.


Chef Fundamentals course on UdemyChef Fundamentals course on Udemy – this is delivered by Robin Beck (@stellarsquall) from TechnoTrainer, and is really a great hands-on video course, in which you use Vagrant on your laptop to run a local on-demand Chef infrastructure. Cannot recommend this highly enough.

Basic Chef Fluency Badge – this is the entry level certification for the Chef product suite; the first towards the Chef Certified Developer accolade. This is a great way to target studies towards a broad knowledge of the various products offered by Chef Inc.

Chef Rally – this site came along after I had done my first certification exam, but it would have been really useful beforehand! This runs through every element of the Chef Inc product suite, diving in deep to teach some complex topics.

Chef Documentation – the documentation site is the mecca for details on the core product – how to use, deploy, and develop infrastructure based on Chef. Some of it is out of date, but it is still an often referenced source of truth.


Having now worked with all the major CM platforms, I still believe Chef is the best one to get started with – it has great Windows support, and a huge library of existing cookbooks. The community is large, and writing cookbooks is a great way to learn things like Test Driven Development and the Ruby programming language. With first-class services on Azure and AWS by way of Chef Automate and OpsWorks Automate, Chef is taking center stage in the public cloud, and Chef Inc are piling effort into educating and publicising the Chef ecosystem.

Advertisements

Cleaning up AWS OpsWorks Automate Nodes

I’ve been playing with Chef and AWS’ OpsWorks Automate product a lot in the last few weeks, one problem I had was that as I kept bootstrapping EC2 instances, using the excellent Knife EC2 tool, the nodes were not being cleaned up out of the Chef Automate portal. I’m imagining this will be a common issue for folks using ephemeral type workloads with Chef Automate in any cloud.

AWS’ documentation has some AWS CLI commands to run to remove old nodes, but this refers to AWS CLI commands which do not seem to be present in the latest version of AWS CLI (there is no ‘aws opsworks-cm’ domain now in the CLI, so no way of managing OpsWorks Automate).

I found this┬ápage in Chef’s highly recommended Learn Chef Rally training site which led me to the way to do this. The following can be run from an SSH connection into your Chef Automate server (or in my case, as I had not assigned a keypair on creation of my Automate server, through EC2 Systems Manager’s Run Command feature):

sudo automate-ctl delete-visibility-node <NODE_NAME>

If you have multiple nodes with the same name, you may receive the following response:

Multiple nodes were found matching your request. Please delete by ID using: automate-ctl delete-visibility-node-by-id NODE_UUID

Node UUID Node Name Org Name Chef Server
==================================== ========= ======== ===========
1c298e89-7c9f-4feb-b784-20b3858bfd6f webtest2 default chefautomate-1abcdefgo12abcde.eu-west-1.opsworks-cm.io
7f9b96df-7c02-4277-a5bb-879962b17136 webtest2 default chefautomate-1abcdefgo12abcde.eu-west-1.opsworks-cm.io
05f55344-2425-4764-8db6-9c0a0ef8d015 webtest2 default chefautomate-1abcdefgo12abcde.eu-west-1.opsworks-cm.io

You can delete these using the following command instead:

sudo automate-ctl delete-visibility-node-by-id <NODE_ID>

This wraps up the post, hopefully it comes in useful for people.