Let’s pretend we have a cookbook named “wonka”
in ~/chef-repo/cookbooks/wonka/attributes/default.rb
default[:wonka][:gobstopper] = "everlasting" default[:wonka][:kazoozle] = "alittle"
We want to override the value of [:wonka][:gobstopper] for a node named “oompaloompa01”
Without an override defined your json should look something like the following
You can issue:
$ knife node edit ooompaloopma01
{
"run_list": [
"recipe[chocolate_factory::default]"
],
"chef_environment": "development",
"name": "oompaloompa01",
"normal": {
"chef_environment": "development",
"name": "oompaloopma01",
"normal": {
"tags": [
]
},
"tags": [
]
}
}
Now let’s say you want to define default[:wonka][:gobstopper] = “allgone” with an override
Your json should look like the following
{
"run_list": [
"recipe[chocolate_factory::default]"
],
"chef_environment": "development",
"name": "oompaloompa01",
"normal": {
"chef_environment": "development",
"name": "oompaloopma01",
"wonka": {
"gobstopper": [
"allgone"
]
},
"normal": {
"tags": [
]
},
"tags": [
]
}
}
that should commit the override to that specific node.
you can check the values of a node’s attributes with the following command ( where the attribute group you want to look at is “wonka” )
$ knife node show oompaloompa01 -a wonka
Now just run chef-client on oompaloopa01 and you should see the override take effect.