May 2015
Intermediate to advanced
278 pages
5h 34m
English
Roles are there in Chef to group nodes with similar configuration. Typical cases are to have roles for web servers, database servers, and so on.
You can set custom run lists for all the nodes in your roles and override attribute values from within your roles.
Let's see how to create a simple role.
For the following examples, I assume that you have a node named server and that you have at least one cookbook (I'll use the ntp cookbook) registered with your Chef server.
Let's create a role and see what we can do with it.
mma@laptop:~/chef-repo $ subl roles/web_servers.rb
name "web_servers" description "This role contains nodes, which act as web servers" run_list "recipe[ntp]" default_attributes 'ntp' ...
Read now
Unlock full access