Permalink
Browse files

Merge branch 'may-revision'

  • Loading branch information...
2 parents 72f04bf + e9a2fcb commit 44c36889b1e9b3c38222792a638e92f132195a64 @jtimberman jtimberman committed May 11, 2012
@@ -12,7 +12,7 @@ This work is licensed under a Creative Commons Attribute Share Alike 3.0 United
# Anatomy of a Chef Run
-<center><img src="../images/anatomy-of-chef-run-0.png" width="424" height="624" /></center>
+<center><img src="../images/anatomy-of-chef-run/anatomy-of-chef-run-full.png" /></center>
.notes This diagram represents the process of running chef.
@@ -120,7 +120,7 @@ Chef expands the node's run list down to the recipes. The roles and recipes get
# Anatomy of a Chef Run
-<center><img src="../images/anatomy-of-chef-run-2.png" width="424" height="624" /></center>
+<center><img src="../images/anatomy-of-chef-run/anatomy-of-chef-run-005.png" /></center>
.notes This diagram represents the process of running chef.
@@ -182,7 +182,7 @@ Once the cookbooks are synchronized to the local system, their components are lo
# Anatomy of a Chef Run
-<center><img src="../images/anatomy-of-chef-run-3.png" width="424" height="624" /></center>
+<center><img src="../images/anatomy-of-chef-run/anatomy-of-chef-run-006.png" /></center>
.notes This diagram represents the process of running chef.
@@ -236,7 +236,25 @@ Chef walks the Resource Collection in order.
# Anatomy of a Chef Run
-<center><img src="../images/anatomy-of-chef-run-4.png" width="424" height="624" /></center>
+<center><img src="../images/anatomy-of-chef-run/anatomy-of-chef-run-007.png" /></center>
+
+.notes This diagram represents the process of running chef.
+
+# Anatomy of a Chef Run
+
+<center><img src="../images/anatomy-of-chef-run/anatomy-of-chef-run-008.png" /></center>
+
+.notes This diagram represents the process of running chef.
+
+# Anatomy of a Chef Run
+
+<center><img src="../images/anatomy-of-chef-run/anatomy-of-chef-run-009.png" /></center>
+
+.notes This diagram represents the process of running chef.
+
+# Anatomy of a Chef Run
+
+<center><img src="../images/anatomy-of-chef-run/anatomy-of-chef-run-010.png" /></center>
.notes This diagram represents the process of running chef.
@@ -266,7 +284,7 @@ Abnormal exit from unhandled exception:
# Anatomy of a Chef Run
-<center><img src="../images/anatomy-of-chef-run-5.png" width="424" height="624" /></center>
+<center><img src="../images/anatomy-of-chef-run/anatomy-of-chef-run-011.png" /></center>
.notes This diagram represents the process of running chef.
@@ -163,6 +163,12 @@ This run list can include recipes that also include other recipes.
These are applied to the node in the order listed.
+ @@@javascript
+ "run_list": [
+ "recipe[apache2]",
+ "recipe[webserver]"
+ ]
+
# Chef Recipes
Recipes are processed in the order they are written.
@@ -323,6 +329,9 @@ Are equivalent. To use a different recipe, specify it by name:
recipe[webserver::different-recipe]
+.notes Chef deduplicates recipes, but there's a bug about using
+webserver and webserver::default and both being included
+
# Add Recipe to a Node
Use knife to add a recipe to an existing node's run list on the Chef
@@ -142,6 +142,8 @@ Installation on Windows is done by downloading the MSI and installing it.
Server versions are directly tested, but the MSI is known to install and work fine on desktop versions of Windows such as Vista and 7.
+.notes Do this now. Download the MSI and install it.
+
# What You Get: Linux/Unix
Chef binaries are in `/opt/opscode/bin`. The package installation symlinks them in `/usr/bin` so they are in the default `$PATH`.
@@ -182,6 +184,11 @@ Non-Chef tools:
* Version control systems (Git, Subversion, Perforce)
* Ruby programming language
+.notes Coverage of these tools is outside the scope of the class.
+Students are assumed to have knowledge and familiarity with the shell,
+text editor and version control system of their choice sufficient for
+working in the hands on exercises.
+
# Chef Tools
Each of the tools bundled with the Chef Full package share some common traits.
@@ -295,7 +302,7 @@ The default configuration file for Knife is `.chef/knife.rb`; knife looks for it
$PWD/".."/.chef/knife.rb
~/.chef/knife.rb
-Opscode Hosted Chef provides a pregenerated `knife.rb` you can use.
+Opscode Hosted/Private Chef provides a pregenerated `knife.rb` you can use.
# Knife Configuration Options
@@ -511,6 +518,9 @@ The default configuration file is `/etc/chef/solo.rb`.
These are similar to `chef-client`, with the addition of `-r`.
+.notes This concludes the material that covers chef-solo, we're going
+to work with a Chef Server for the remainder of the course.
+
# Shef
Shef is an interactive Ruby console that supports attribute and recipe contexts, as well as interactive debugging features.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -103,18 +103,6 @@ systems to use.
Plugins, Reporting. This also may include questions asked during the
course that have not been covered.
-# Agenda: Hack Day
-
-Opscode public Chef Fundamentals training is often followed by a Hack Day.
-
-* Mini-tutorials/talks
-* Demonstrations
-* Collaboration and learning
-* Hacking on Chef, cookbooks and more!
-* Venue varies by location
-
-.notes Discuss any relevant hack day event logistics. If no hack day, skip.
-
# Course Artifacts
At the end of the class you will have:
@@ -33,16 +33,6 @@ example, "`apache2-1.0.8.tar.gz`".
> tar -zxvf apache2-1.0.8.tar.gz -C cookbooks/
> ls cookbooks/apache2
-# Use Your VCS
-
-Knife currently integrates with Git in the "cookbook site install"
-command.
-
-You can use any version control system you like.
-
-There will be additional steps required to untar cookbooks,
-branch/merge, etc, depending on your tool.
-
# Examine the Cookbooks
Remember, you're probably going to run Chef on the nodes as a
@@ -88,11 +78,12 @@ Included recipes from other cookbooks require metadata dependency.
# Cookbook Dependencies
-Remember, cookbook dependencies are assumed when using part(s) of one
-cookbook in another, such as recipe inclusion.
+Remember, cookbook dependencies are *assumed* when using part(s) of one
+cookbook in another, such as recipe inclusion, but they are not
+created automatically.
Cookbook dependencies are explicitly defined in metadata. Use the
-"depends" keyword. This will cause Chef to download the dependency
+"`depends`" keyword. This will cause Chef to download the dependency
cookbook from the server.
Downloading a cookbook as a dependency from another does not cause it
@@ -137,6 +128,9 @@ For example, the default action in the `fail2ban` package resource is
upgrade, so apt will ensure we always have the latest version
including security fixes.
+.notes Other platforms (e.g. RHEL family) might have a yum-related
+recipe instead of apt. Like yum::epel
+
# Apply Role to Node
Applying the role to the node can be done with knife.
@@ -154,7 +148,8 @@ The `$EDITOR` environment variable must be set, or specified with
> knife node edit NODE -e vi
.notes On Windows, use cmd.exe not powershell, else an erroneous entry
-will be made (e.g., recipe[roles]).
+will be made (e.g., recipe[roles]). The %EDITOR% variable can be set
+to, e.g. set EDITOR="C:\Program Files\Windows NT\Accessories\wordpad.exe"
# Apply role to Node
@@ -187,6 +182,9 @@ Many things automated with Chef follow a pattern:
Let's walk through another example of this pattern.
+.notes The haproxy cookbook is used to follow the *pattern*; the
+implementation details are moot.
+
# haproxy Cookbook
Download the haproxy cookbook.
@@ -197,6 +195,10 @@ Download the haproxy cookbook.
We will explore the haproxy cookbook for this pattern because we'll
revisit it in the next section on search.
+.notes In the next section on search we'll look at the parts of the
+haproxy cookbook that are modified to adapt the recipe for this
+flexibility.
+
# haproxy default recipe
The default recipe follows the pattern.
@@ -221,7 +223,7 @@ many platforms.
action :install
end
-.notes On RHEL, it is available from EPEL.
+.notes On RHEL, it is available from EPEL, use yum::epel in the base role.
# haproxy default template
@@ -236,7 +238,9 @@ On Debian/Ubuntu, the service is controlled by a config file
mode 0644
end
-.notes Due to this specific file, the recipe won't work on RHEL systems.
+.notes Due to this specific file, the recipe won't work on RHEL
+systems. If the exercises are done on RHEL systems, then we can
+comment this out when it is used.
# haproxy default template
@@ -321,6 +325,8 @@ set by the cookbook. Excerpts from the template:
default['haproxy']['enable_admin'] = true
default['haproxy']['balance_algorithm'] = "roundrobin"
+.notes This syntax is because we access the attributes *like* a Hash.
+
# haproxy modifying attributes
We can modify the attributes directly editing the cookbook, or even
@@ -339,6 +345,9 @@ better, by applying them with a role appropriate to the task.
}
)
+.notes This syntax is because we are creating the attributes *as* a
+Hash.
+
# Summary
* Download additional cookbooks with knife
@@ -28,8 +28,6 @@ Four search indexes are created on the Chef Server by default.
* role
* environment
-# Search Indexes
-
When data bags are created, a search index is also created, and the
index is the same name as the bag.
@@ -49,6 +47,7 @@ is abbreviated.
# Knife Search
knife search node "platform:ubuntu"
+ knife search node "platform:centos"
knife search node "platform:ubuntu" -r
knife search node "role:webserver"
@@ -313,6 +312,10 @@ bootstrap" command.
The `haproxy::app_lb` recipe will perform a search for web servers.
+.notes Modify the app_lb recipe to remove
+template[/etc/default/haproxy] resource if the exercise is on RHEL or
+CentOS platforms.
+
# Bootstrap Load Balancer
knife bootstrap IPADDRESS -r 'role[lb]' -x ubuntu --sudo
Oops, something went wrong.

0 comments on commit 44c3688

Please sign in to comment.