dnf-automatic: create a drop-in for the Mon..Fri configuration
See https://github.com/fedora-copr/copr/issues/3623#issuecomment-2656844947
This commit is contained in:
parent
3602ac8f97
commit
fa9a8edeb0
1 changed files with 16 additions and 3 deletions
|
@ -7,10 +7,17 @@
|
||||||
#
|
#
|
||||||
- name: Install and configure dnf-automatic
|
- name: Install and configure dnf-automatic
|
||||||
when: ansible_pkg_mgr == 'dnf'
|
when: ansible_pkg_mgr == 'dnf'
|
||||||
|
|
||||||
|
vars:
|
||||||
|
dnf: "{{ 5 if (ansible_distribution_major_version | int >= 41 and ansible_distribution == 'Fedora') else 4 }}"
|
||||||
|
package: "{{ 'dnf5-plugin-automatic' if dnf == '5' else 'dnf-automatic' }}"
|
||||||
|
timer: "{{ 'dnf5-automatic.timer' if dnf == '5' else 'dnf-automatic-install.timer' }}"
|
||||||
|
confdir: "/etc/systemd/system/{{ timer }}.d"
|
||||||
|
|
||||||
block:
|
block:
|
||||||
- name: Install dnf-automatic
|
- name: Install dnf-automatic
|
||||||
ansible.builtin.dnf:
|
ansible.builtin.dnf:
|
||||||
name: "{{ 'dnf5-plugin-automatic' if (ansible_distribution_major_version | int >= 41 and ansible_distribution == 'Fedora') else 'dnf-automatic' }}"
|
name: "{{ package }}"
|
||||||
state: present
|
state: present
|
||||||
disablerepo: updates
|
disablerepo: updates
|
||||||
tags:
|
tags:
|
||||||
|
@ -24,9 +31,15 @@
|
||||||
tags:
|
tags:
|
||||||
- config
|
- config
|
||||||
|
|
||||||
|
- name: Create directory for drop-in units
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: "{{ confdir }}"
|
||||||
|
state: directory
|
||||||
|
mode: "755"
|
||||||
|
|
||||||
- name: Set dnf-automatic to execute only on Mon-Fri
|
- name: Set dnf-automatic to execute only on Mon-Fri
|
||||||
community.general.ini_file:
|
community.general.ini_file:
|
||||||
path: "{{ '/usr/lib/systemd/system/dnf5-automatic.timer' if (ansible_distribution_major_version | int >= 41 and ansible_distribution == 'Fedora') else '/usr/lib/systemd/system/dnf-automatic-install.timer' }}"
|
path: "{{ confdir }}/weekdays.conf"
|
||||||
section: Timer
|
section: Timer
|
||||||
option: OnCalendar
|
option: OnCalendar
|
||||||
value: Mon..Fri *-*-* 6:00:00
|
value: Mon..Fri *-*-* 6:00:00
|
||||||
|
@ -37,7 +50,7 @@
|
||||||
|
|
||||||
- name: Enable and start dnf-automatic timer
|
- name: Enable and start dnf-automatic timer
|
||||||
ansible.builtin.service:
|
ansible.builtin.service:
|
||||||
name: "{{ 'dnf5-automatic.timer' if (ansible_distribution_major_version | int >= 41 and ansible_distribution == 'Fedora') else 'dnf-automatic-install.timer' }}"
|
name: "{{ timer }}"
|
||||||
enabled: true
|
enabled: true
|
||||||
state: started
|
state: started
|
||||||
tags:
|
tags:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue