Reputation: 15599
I want to know what is the correct way to assign node['ipaddress']
OHAI attribute within the chef role. My chef role is defined in the JSON format
.
{
"name": "temp_role",
"description": "This is temp role",
"json_class": "Chef::Role",
"default_attributes": {
"client_addr": #{node['ipaddress']}
},
"override_attributes": {
},
"chef_type": "role",
"run_list": [
"recipe[test::prereq]"
],
"env_run_lists": {
}
}
Upvotes: 0
Views: 639
Reputation: 54251
You cannot use ohai data in roles, JSON format or otherwise. Roles are purely static data, converted to JSON during upload even if they are using the .rb
DSL. anything dynamic must live in a cookbook, in this case probably a role-pattern cookbook.
Upvotes: 1