2. What is Chef?
chef is a tool that will help to provision servers and manage their state.
These servers could be physical, in the cloud, or hosted in a VMware stack. They could have
access to the internet or be locked behind a firewall. No matter how you segregate your
network, Chef has a solution that can work for you.
4. Functions of Server, Nodes and
Workstations
Chef comprises of three main elements a server, one (or more) nodes, and at least one
workstation. The server acts as a hub that is available to every node in the organization.
Ensures right cookbooks (and recipes) are available, right policies are applied, the node object
used during the previous chef-client run is available to the current chef-client run, and that all of
the nodes that will be maintained by the chef-client are registered and known to the server.
5. Functions of Server, Nodes and
Workstations
Workstations are static computers or virtual servers where all code is created or changed. There
can been as many workstations as needed, whether this be one per person or otherwise.
nodes are the servers that need to be managed by Chef – these are the machines that changes
are being pushed to, generally a fleet of multiple machines that require the benefits of an
automation program.
chef ensures each node in your infrastructure complies with the policy
6. Policy?
chef provides a domain-specific language (DSL) that allows you to specify policy for your
infrastructure
policy describes the desired state
policies can be statically and dynamically defined
7. Resources (Fundamental building blocks)
piece of the system and its desired state
◦ package that should be installed
◦ service that should be running
◦ File that should be generated
◦ Cron job that should be configured
◦ User that should be managed
◦ https://docs.chef.io/resources.html
8. Chef-apply
chef-appy is an executable program that allows you to work with resources
is included as part of the ChefDK
A great way to explore resources
Not how you'll eventually use chef in production
9. Hands on
Install an editor
◦ chef-apply -l info -e "package 'vim'"
Create a file
◦ chef-apply -l info -e "file '/tmp/chefManaged.txt' do content 'This content is chef managed' end"
10. Test and Repair
Resources follow test and repair model
Resource currently in the desired state? (test)
◦ yes - do nothing
◦ No - bring the resource into the desired state (repair)
11. Recipe
Collection of resources
Recipes can
◦ install and configure software components
◦ manage files
◦ deploy applications
◦ execute other recipes and more...
12. Hands on
We need a web server configured to serve our home page
What is required to meet this state?
◦ What resources will we need?
◦ Chef-apply apache.rb