Cleaning up templates for dnf-automatic

This commit is contained in:
Tyler Hale 2022-08-22 14:28:58 -06:00
parent 9e87e0aad6
commit ec5e6d3dff
Signed by: Tyler
GPG key ID: C7CC4B910D88EF96
7 changed files with 16 additions and 8 deletions

View file

@ -102,6 +102,9 @@ base_redhat_epel: true
# DNF Automatic # DNF Automatic
# ============= # =============
base_redhat_dnf_automatic_timer: "02:00"
base_redhat_dnf_automatic_timer_randomizer: "5m"
# commands # commands
# -------- # --------

View file

@ -42,9 +42,18 @@
recurse: yes recurse: yes
state: directory state: directory
- name: Deploy dnf-automatic install service override - name: Deploy dnf-automatic install service override (YUM versions)
template: template:
src: "dnf-automatic-install.service-{{ ansible_distribution_major_version }}.j2" src: "dnf-automatic-install.service-yum.j2"
dest: /etc/systemd/system/dnf-automatic-install.service.d/override.conf dest: /etc/systemd/system/dnf-automatic-install.service.d/override.conf
become: true become: true
notify: Daemon Reload notify: Daemon Reload
when: ansible_distribution_major_version == 7
- name: Deploy dnf-automatic install service override (DNF versions)
template:
src: "dnf-automatic-install.service-dnf.j2"
dest: /etc/systemd/system/dnf-automatic-install.service.d/override.conf
become: true
notify: Daemon Reload
when: ansible_distribution_major_version != 7

View file

@ -1,2 +0,0 @@
[Service]
ExecStartPost=/bin/sh -ec 'dnf needs-restarting -r | grep -q "Reboot is req.*" && shutdown -r +5 Rebooting after applying package updates || exit 0'

View file

@ -1,2 +0,0 @@
[Service]
ExecStartPost=/bin/sh -ec 'dnf needs-restarting -r | grep -q "Reboot is req.*" && shutdown -r +5 Rebooting after applying package updates || exit 0'

View file

@ -1,5 +1,5 @@
[Timer] [Timer]
OnBootSec= OnBootSec=
OnCalendar= 2:00 OnCalendar={{ base_redhat_dnf_automatic_timer }}
RandomizedDelaySec=5m RandomizedDelaySec={{ base_redhat_dnf_automatic_timer_randomizer }}
AccuracySec=1s AccuracySec=1s