Skip to content

Commit

Permalink
some clean up in the roles section
Browse files Browse the repository at this point in the history
  • Loading branch information
jtimberman committed Jan 24, 2012
1 parent db8d9ea commit 6a3229f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
8 changes: 1 addition & 7 deletions guides/student-exercises/roles.md
Expand Up @@ -10,7 +10,7 @@ Roles
## Acceptance Criteria

* Directory in Chef Repository for role Ruby DSL files
* `base` role containing `fail2ban`
* `base` role contains recipe `fail2ban`
* Target system's node uses the `base` role in its run list

## Create Base Role
Expand All @@ -29,16 +29,10 @@ Re-run `chef-client` on the node.

What are the required components of a role?


How can the contents of the role on the Chef Server be displayed? What command-line option will show the JSON source?


What `knife` command is used to display only the node's run list?


When `chef-client` is run again on the node, what is the content of the `roles` attribute on the node object? What is the content of `recipes`? What is the run list?


When `chef-client` is run again on the node, did it make any changes to the managed resources?


14 changes: 10 additions & 4 deletions slides/roles/01_slide.md
Expand Up @@ -26,13 +26,14 @@ Attributes

# Creating Roles

The roles directory in the chef-repo contains the roles for the infrastructure.
The `roles` directory in the chef-repo contains the roles for the infrastructure.

Write roles using a Ruby DSL.

$EDITOR roles/base.rb

Upload the roles to the Chef Server.
Upload the roles to the Chef Server. Knife will automatically look for
the specified file in the `roles` directory.

knife role from file base.rb

Expand All @@ -47,6 +48,9 @@ Chef supports Ruby DSL or JSON for role files in chef-repo.
* Chef Server stores roles as JSON.
* `knife role show` displays JSON and can be redirected to a file.

.notes We commonly use the Ruby DSL for creating roles, because it is
a bit lighter syntax, and allows flexibility of using Ruby idioms.

# Building Roles

What kind of roles do we need?
Expand Down Expand Up @@ -103,7 +107,9 @@ For example, it is common in a web-application architecture to have webservers.

# Per-service Roles

Other common roles:
We create separate roles that are service specific. This allows us to
break up services to run on separate hosts, or on a single
host. Common roles in web applications:

* `database_master`
* `load_balancer`
Expand Down Expand Up @@ -158,7 +164,7 @@ attributes.

Use knife:

knife node run list add NODE role[base]
knife node run list add NODE 'role[base]'

# Summary

Expand Down

0 comments on commit 6a3229f

Please sign in to comment.