I have setup a default variable in cookbook default attribute like below
node.default['splunk']['workflow']['do_conf'] = 1
I use this variable as the switch on/off of the template creation in the recipe.
template "/opt/splunk/etc/system/local/server.conf" do
....
notifies :restart, 'service[splunk]', :delayed
only_if { node['splunk']['workflow']['do_conf'] == 1 }
end
I would like to override it in environment env1. This is the environment called env1(son format)
{
"name": "env1",
"description": "test env",
"cookbook_versions": {
},
"json_class": "Chef::Environment",
"chef_type": "environment",
"default_attributes": {
"node": {
"splunk": {
"workflow": {
"do_conf": 0
}
}
}
},
"override_attributes": {
}
}
But it seems not working, the template is still created and notify the service to restart.
Is anything wrong in my attribute/recipe/environment?