--- tags: - chef references: - https://docs.chef.io/nodes/#node-objects - https://docs.chef.io/attribute_precedence/ --- ``` cookbooks/onecom-baseline/attributes/default.rb 122:# unattended-upgrades 123:default['unattended-upgrades']['enable'] = false ``` We should override that somehow. Let's take a look below at how the attribute can be overridden. ``` chef-repo master ❯ cat roles/onecom-mailpod-mailstorage-focal-22.json { "name": "onecom-mailpod-mailstorage-focal-22", "description": "One.com mailpod mailstorage Ubuntu Focal role - Dovecot 2.2.x", "json_class": "Chef::Role", "default_attributes": { "apt": { "repositories": { "dovecot22-production": { "action": "add" } } }, "dovecot": { "version": "1:2.2.36.4-1onecom5+20201026.1518.12cbf375.dovecot22.focal1" } }, "override_attributes": { "unattended-upgrades": { "enable": false, "upgrade": "0" }, "prometheus": { "node_exporter": { "collector": { "systemd": { "unit-whitelist": { "unattended-upgrades": false } } } } } }, "chef_type": "role", "run_list": [ "role[onecom-mailpod-mailstorage-focal]" ] } ``` **The following table specifies attribute precedence:** |Application Order (Last One Wins)|Attribute Type|Source Order| |1|`default`|Cookbook attribute fileRecipeEnvironmentRole| |2|`force_default`|Cookbook attribute fileRecipe| |3|`normal`|JSON file passed with `chef-client -j`Cookbook attribute fileRecipe| |4|`override`|Cookbook attribute fileRecipeRoleEnvironment| |5|`force_override`|Cookbook attribute fileRecipe| |6|`automatic`|Identified by Ohai at the start of a Chef Infra Client Run| So apparently for level 4 we have to set "override_attributes" in the node definition.0-=