commit c7eaae2b42b02e1c662465f0b79f2055148620f4
Author: Nicolas Chauvet <kwizart(a)gmail.com>
Date: Fri Jun 5 17:14:07 2020 +0200
Update dnf-automatic
roles/dnf-automatic/tasks/main.yml | 37 ++++++++++++++++++++++++++++-------
1 files changed, 29 insertions(+), 8 deletions(-)
---
diff --git a/roles/dnf-automatic/tasks/main.yml b/roles/dnf-automatic/tasks/main.yml
index a848291..11245f3 100644
--- a/roles/dnf-automatic/tasks/main.yml
+++ b/roles/dnf-automatic/tasks/main.yml
@@ -23,7 +23,7 @@
- name: enable and start dnf-automatic
command: systemctl enable dnf-automatic.timer
- when: ansible_distribution_major_version|int < 26
+ when: ansible_distribution_major_version|int < 8
args:
creates: /etc/systemd/system/basic.target.wants/dnf-automatic.timer
tags:
@@ -35,17 +35,25 @@
check_mode: no
changed_when: 1 != 1
ignore_errors: true
- when: ansible_distribution_major_version|int < 26
+ when: ansible_distribution_major_version|int < 8
- name: start dnf-automatic.timer if it is not active
command: systemctl start dnf-automatic.timer
- when: automaticative|failed and ansible_distribution_major_version|int < 26
+ when: automaticative is failed and ansible_distribution_major_version|int < 8
- name: enable and start dnf-automatic f26+
command: systemctl enable dnf-automatic-install.timer
- when: ansible_distribution_major_version|int >= 26
- args:
- creates: /etc/systemd/system/basic.target.wants/dnf-automatic-install.timer
+ when: ansible_distribution_major_version|int >= 29 and ansible_distribution ==
'Fedora'
+ register: dnfautomaticenable
+ changed_when: dnfautomaticenable.rc != 0
+ tags:
+ - config
+
+ - name: enable and start dnf-automatic RHEL8+
+ command: systemctl enable dnf-automatic-install.timer
+ when: ansible_distribution_major_version|int >= 8 and ansible_distribution ==
'CentOS'
+ register: dnfautomaticenable
+ changed_when: dnfautomaticenable.rc != 0
tags:
- config
@@ -55,13 +63,26 @@
check_mode: no
changed_when: 1 != 1
ignore_errors: true
- when: ansible_distribution_major_version|int >= 26
+ when: ansible_distribution_major_version|int >= 8 and ansible_distribution ==
'CentOS'
+
+ - name: check if dnf-automatic-install.timer is active
+ command: systemctl is-active dnf-automatic-install.timer
+ register: automaticative
+ check_mode: no
+ changed_when: 1 != 1
+ ignore_errors: true
+ when: ansible_distribution_major_version|int >= 29 and ansible_distribution ==
'Fedora'
- name: start dnf-automatic-install.timer if it is not active
command: systemctl start dnf-automatic-install.timer
- when: automaticative|failed and ansible_distribution_major_version|int >= 26
+ when: automaticative is failed and ansible_distribution_major_version|int >= 8 and
ansible_distribution == 'CentOS'
+
+ - name: start dnf-automatic-install.timer if it is not active
+ command: systemctl start dnf-automatic-install.timer
+ when: automaticative is failed and ansible_distribution_major_version|int >= 29
and ansible_distribution == 'Fedora'
- name: disable silly makecache timer
systemd: name=dnf-makecache masked=yes
+ ignore_errors: true
when: ansible_pkg_mgr == 'dnf'
Show replies by date