Ansible-Linux_Base/roles/base/tasks/redhat_automatic_updates.yml

50 lines
1.3 KiB
YAML

---
# file: roles/base/tasks/redhat_automatic_updates.yml
- name: Install dnf-automatic package
package:
name: dnf-automatic
state: present
- name: Install yum-utils package for needs restarting
package:
name: yum-utils
state: present
when: ansible_distribution_major_version == 7
- name: Deploy dnf-automatic configuration file
template:
src: automatic.conf.j2
dest: /etc/dnf/automatic.conf
- name: Create dnf-automatic-install.timer directory
file:
path: /etc/systemd/system/dnf-automatic-install.timer.d
recurse: yes
state: directory
- name: Deploy dnf-automatic install timer override
template:
src: dnf-automatic-install.timer.j2
dest: /etc/systemd/system/dnf-automatic-install.timer.d/time.conf
become: true
notify: Daemon Reload
- name: Start and enable systemd timer for dnf-automatic
service:
name: dnf-automatic-install.timer
state: started
enabled: yes
- name: Create dnf-automatic-install.service directory
file:
path: /etc/systemd/system/dnf-automatic-install.service.d
recurse: yes
state: directory
- name: Deploy dnf-automatic install service override
template:
src: "dnf-automatic-install.service-{{ ansible_distribution_major_version }}.j2"
dest: /etc/systemd/system/dnf-automatic-install.service.d/override.conf
become: true
notify: Daemon Reload