From 80ccf68f55dbb70d7e5ed52ee95b3c9d1b6ce264 Mon Sep 17 00:00:00 2001 From: Jasper Ras Date: Thu, 20 Mar 2025 11:07:49 +0100 Subject: vault backup: 2025-03-20 11:07:48 --- 4 Archives/Disable unattended-upgrades VPS.md | 66 +++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 4 Archives/Disable unattended-upgrades VPS.md (limited to '4 Archives/Disable unattended-upgrades VPS.md') diff --git a/4 Archives/Disable unattended-upgrades VPS.md b/4 Archives/Disable unattended-upgrades VPS.md new file mode 100644 index 0000000..c32ada0 --- /dev/null +++ b/4 Archives/Disable unattended-upgrades VPS.md @@ -0,0 +1,66 @@ +--- +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-= \ No newline at end of file -- cgit v1.2.3