まっしろけっけ

めもてきなやーつ

roleとnodeについて

run_listやAttributeをノードの役割ごとにグルーピング出来るので便利

アプリケーションサーバ用のroleを作成してみる

$ vi roles/application_server.json
{
  "name"                : "application_server",
  "default_attributes"  : ”nginx” => {
    "port" => 80
  },
  "override_attributes" : {},
  "json_class"          : "Chef::Role",
  "description"         : "",
  "chef_type"           : "role",
  "run_list"            : [
    "recipe[nginx]",
    "recipe[ruby]"
  ]
}

application_serverにはnginx, rubyがinstallされるということがわかる。
Attributesにはnginxのport番号を設定しているのでrecipeやtemplate内で使用可能
続いてNode Objectのjsonファイルを編集

$ vi nodes/hoge.json
{
  "run_list" : [
    "role[application_server]"
  ]
}

Node Objectにはroleとrecipeを混ぜて書くことも可能

内容が薄い気がする。。。
後ほど追記するかもです