Chef - Environment attributes and Role Attribute

154 views Asked by At

I have chef 4 different role json files which uses the same recipe abc but takes different values for the same role.how to pass the values from environment json file.

roleA.json
{
 "name": "abc1",
 "runlist": ["recipe[abc]"],
 "default_attributes":{
 "grp":"value1"
  }
  }

 roleB.json
 {
  "name": "abc2",
  "runlist": ["recipe[abc]"],
  "default_attributes":{
  "grp":"value2"
 }
 }

etc.

How can i pass different values from environment file for grp in roles.

Thanks!!

1

There are 1 answers

0
coderanger On

Environment (and role) attribute data all gets merged into the Node object with all other attributes, so you can access it via node['grp'].