1. Learn the Chef basics - Ubuntu
Objectives:
- have a basic understanding of what happens when Chef runs.
- be able to write Chef code that defines a basic policy.
- be able to apply that policy to a server.
a. Get set up
- Launch an Ubuntu virtual machine hosted by the chef.
- use vim for text editor
b. Configure a resource
Chef component | Description |
---|---|
resource | describes some piece of infrastructure, such as a file, a template, or a package. |
recipe | a file that groups related resources, such as everything needed to configure a web server, database server, or a load balancer. |
cookbook | provides structure to your recipes and enables, such as our web server’s home page. In essence, a cookbook helps you stay organized. |
knife | enables you to interact with the Chef server |
node | all the computer resources infrastructure managed by Chef |
file chef docs
directory chef docs
chef-repo save all the resources files
hello.rb is a recipe, motd file is the resource. Resource also can be package, service.
The functionalities of recipe:
- install and configure software components.
- manage files.
- deploy applications.
- execute other recipes.
c. Configure a package and service
Install the Apache package
The order in the recipe is very important. But the orders of the attributes of the file is doesn’t matter.
Verification
|
d. Make your recipe more manageable
mkdir cookbooks, use templates to handle html. chef-client to run the cookbooks with the recipe list.
2. Learn to manage Ubuntu Node
objectives:
- be able to write Chef code to define a policy from your workstation.
- be able to apply that policy to a node.
- understand how to access cookbooks written by the Chef community.
a. Get Set up
configure the chef locally
b. Set up your Chef server
Download cookbook from the chef supermarkets
c. Bootstrap your node
A very long command, don’t forget to apt-get update.
|
d. Update your node’s configuration
You ran knife bootstrap to associate your node with the Chef server and do an initial check-in. Bootstrapping is a one-time process.
The knife ssh command enables you to update your node’s configuration when your cookbook changes.