diff options
author | Sam Chudnick <sam@chudnick.com> | 2023-06-25 09:52:36 -0400 |
---|---|---|
committer | Sam Chudnick <sam@chudnick.com> | 2023-06-25 09:52:36 -0400 |
commit | 95b73daa36b23565a8566f71f9b202d3459b685f (patch) | |
tree | cb17b021be70e7868d0ec235a761f0ecdc80f3f2 /roles/services/unattended_upgrades |
Diffstat (limited to 'roles/services/unattended_upgrades')
-rw-r--r-- | roles/services/unattended_upgrades/tasks/main.yml | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/roles/services/unattended_upgrades/tasks/main.yml b/roles/services/unattended_upgrades/tasks/main.yml new file mode 100644 index 0000000..bad3c02 --- /dev/null +++ b/roles/services/unattended_upgrades/tasks/main.yml | |||
@@ -0,0 +1,63 @@ | |||
1 | - name: install packages | ||
2 | package: | ||
3 | name: "{{ unattended_upgrades_packages }}" | ||
4 | state: latest | ||
5 | |||
6 | - name: edit apt update timer | ||
7 | lineinfile: | ||
8 | path: /etc/systemd/system/timers.target.wants/apt-daily.timer | ||
9 | regexp: "OnCalendar.*" | ||
10 | line: "OnCalendar=*-*-* 0,4,8,12,16,20:00" | ||
11 | |||
12 | - name: edit apt update timer | ||
13 | lineinfile: | ||
14 | path: /etc/systemd/system/timers.target.wants/apt-daily.timer | ||
15 | regexp: "RandomizedDelaySec.*" | ||
16 | line: "RandomizedDelaySec=10m" | ||
17 | |||
18 | - name: edit apt upgrade timer | ||
19 | lineinfile: | ||
20 | path: /etc/systemd/system/timers.target.wants/apt-daily-upgrade.timer | ||
21 | regexp: "OnCalendar.*" | ||
22 | line: "OnCalendar=*-*-* 0,4,8,12,16,20:30" | ||
23 | |||
24 | - name: edit apt upgrade timer | ||
25 | lineinfile: | ||
26 | path: /etc/systemd/system/timers.target.wants/apt-daily-upgrade.timer | ||
27 | regexp: "RandomizedDelaySec.*" | ||
28 | line: "RandomizedDelaySec=5m" | ||
29 | |||
30 | - name: edit APT::Periodic settings | ||
31 | lineinfile: | ||
32 | path: /etc/apt/apt.conf.d/20auto-upgrades | ||
33 | regexp: "APT::Periodic::Update.*" | ||
34 | line: 'APT::Periodic::Update-Package-Lists "always";' | ||
35 | |||
36 | - name: edit APT::Periodic settings | ||
37 | lineinfile: | ||
38 | path: /etc/apt/apt.conf.d/20auto-upgrades | ||
39 | regexp: "APT::Periodic::Unattended.*" | ||
40 | line: 'APT::Periodic::Unattended-Upgrade "always";' | ||
41 | |||
42 | - name: configure unattended upgrades | ||
43 | lineinfile: | ||
44 | path: /etc/apt/apt.conf.d/50unattended-upgrades | ||
45 | regexp: ".*Unattended-Upgrade::Mail.*" | ||
46 | line: 'Unattended-Upgrade::Mail "{{ uu_mail_to }}";' | ||
47 | |||
48 | - name: configure unattended upgrades | ||
49 | lineinfile: | ||
50 | path: /etc/apt/apt.conf.d/50unattended-upgrades | ||
51 | insertafter: 'Unattended-Upgrade::Mail "{{ uu_mail_to }}";' | ||
52 | line: 'Unattended-Upgrade::Sender "{{ uu_mail_from }}";' | ||
53 | |||
54 | - name: configure unattended upgrades | ||
55 | lineinfile: | ||
56 | path: /etc/apt/apt.conf.d/50unattended-upgrades | ||
57 | regexp: ".*Unattended-Upgrade::MailReport.*" | ||
58 | line: 'Unattended-Upgrade::MailReport "always";' | ||
59 | |||
60 | - name: restart service | ||
61 | service: | ||
62 | name: unattended-upgrades | ||
63 | state: restarted | ||