summaryrefslogtreecommitdiff
path: root/4 Archives/Disable unattended-upgrades VPS.md
blob: c32ada03fa23e5952cb342d782f37f00b5a0ec63 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
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-=