Information Technology Reference
In-Depth Information
$ knife upload nodes
Created nodes/snowman.json
Created nodes/atwood.json
Created nodes/susu.json
Create a roles directory in chef-playground :
$ mkdir roles
We're going to create a .json file representing the role data. A basic role has a name: , de-
scription: , and run_list . The role can be used to encapsulate a long list of recipes into
just one alias. Create file chef-playground/roles/webserver.json with the code in
Example 14-1 .
Example 14-1. chef-playground/roles/webserver.json
{
"name" : "webserver" ,
"description" : "Web Server" ,
"json_class" : "Chef::Role" ,
"chef_type" : "role" ,
"run_list" : [
"recipe[motd]" ,
"recipe[users]" ,
"recipe[apache]"
]
}
Then run knife role from file passing in the webserver.json file. Similar to data bags,
knife role from file assumes webserver.json is located in a subdirectory named roles ,
and not in the current directory.
$ knife role from file webserver.json
Updated Role webserver!
Run knife show role as follows to display the details about the webserver role:
$ knife role show webserver
chef_type: role
default_attributes:
description: Web Server
Search WWH ::




Custom Search