L22 – Chef Environments
Map workflow for chef.
Different cookbook versions for different environments,
e.g. development and production
Environment information can be stored in JSON or .rb files.
Located in chef-repo/environments
example for a dev
name “dev1”description “Dev Test 1”
cookbook “security”,”=0.1.0″
cookbook “motd”,”=0.2.0″
cookbook “apache”,”=0.3.0″
override_attributes({
“author” => {
“name” => true
}
})
Override precedence is greater than
Default, force_default, normal
Modify the client.rb with an environment variable
Knife-flip can set the environment for a node
We can assign it on the node.
We will:
Configure DEV and PROD environments
Modify cookbooks with versions
Set new version to dev and old to prod
Change client.rb to look at the correct environment
Discussion ¬