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:
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>.
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/.