Logo

MacStadium Blog

Intro to Chef: Configuration and Automation Tool for Mac VMs

Jump into part one of our Chef series, where we introduce some concepts and ideas for beginners and discuss the latest update to the Chef training materials.

Chef is a declarative configuration and automation management tool that is used to stand up infrastructure as code. Generally, MacStadium customers who use Chef are working with VMs running on VMware’s ESXi layer. This is so powerful because it allows users to maintain a known and constant environment for the sake of reliable unit and integration testing.

For this intro for beginners, we’ll discuss the automation system and infrastructure automation with Chef. Let’s jump in with the three major components to a Chef automation system:

  • Chef server: the central control agent, the Chef server manages, stores, and delivers config data to all the other Chef components.
  • Workstation(s): the human-machine interface – this is where all configuration code is written, tested, and edited. It can be either a personal computer or a virtual machine. Some teams prefer a VM solution because then a simple distribution of credentials will allow multiple team members to access the workstation(s).  
  • Nodes: the worker agents where the CI is being done. These are generally VMs, and generally, there will be a fleet of nodes. At MacStadium, this is most often a VMware ESXi layer – upon which the fleet of Chef nodes (which are actually VMware VMs) will live.

The Chef team has just updated their online training materials. Of particular note for MacStadium customers is the course entitled “Manage Your Fleet with Chef Infra.” As you work through the tutorial, you will need to install the Chef Workstation in order to generate the following YAML file.

---
driver:
 name: vagrant
## The forwarded_port port feature lets you connect to ports on the VM guest via
## localhost on the host.
## see also: https://www.vagrantup.com/docs/networking/forwarded_ports.html

#  network:
#    - ["forwarded_port", {guest: 80, host: 8080}]

provisioner:
 name: chef_zero
 ## product_name and product_version specifies a specific Chef product and version to install.
 ## see the Chef documentation for more details: https://docs.chef.io/workstation/config_yml_kitchen/
 #  product_name: chef
 #  product_version: 16

verifier:
 name: inspec

platforms:
 - name: ubuntu-20.04
 - name: centos-8

suites:
 - name: default
   verifier:
     inspec_tests:
       - test/integration/default
   attributes:

It’s important to know that Chef’s tutorial uses VirtualBox rather than VMware, but the high-level operations are very much like those that MacStadium customers can use “out-of-the-box.”

Once the above file has been generated, there are just a few simple terminal commands with the Chef’s CLI tool Kitchen that are required to stand up the VM(s) described therein.

You'll need to run kitchen list, which will list all VMs described in the above file and ensure that your YAML is error-free. Next, you will run kitchen create in order to stand up the VMs listed. And finally, you will need to call kitchen login <vm platform="" name=""></vm>.

TL;DR

Chef is an automated solution for server configuration. It integrates well with VMware running in a MacStadium cloud, and over the next few weeks, we’ll be showing you how to achieve that. To do so, we’ll be adapting the study materials provided at https://learn.chef.io/.

Logo

Orka, Orka Workspace and Orka Pulse are trademarks of MacStadium, Inc. Apple, Mac, Mac mini, Mac Pro, Mac Studio, and macOS are trademarks of Apple Inc. The names and logos of third-party products and companies shown on the website are the property of their respective owners and may also be trademarked.

©2023 MacStadium, Inc. is a U.S. corporation headquartered at 3525 Piedmont Road, NE, Building 7, Suite 700, Atlanta, GA 30305. MacStadium, Ltd. is registered in Ireland, company no. 562354.