From 71dfa27519317fde195dd16add8b532b5f6a4a1f Mon Sep 17 00:00:00 2001 From: Adrien Reslinger Date: Sat, 9 Jan 2021 10:44:20 +0100 Subject: [PATCH] Active les MAJ CentOS8 --- tasks/main.yml | 22 ++++++++- templates/etc/dnf/automatic.conf | 81 ++++++++++++++++++++++++++++++++ vars/RedHat_8.yml | 4 +- 3 files changed, 104 insertions(+), 3 deletions(-) create mode 100644 templates/etc/dnf/automatic.conf diff --git a/tasks/main.yml b/tasks/main.yml index 032cdea..6e3d217 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -55,7 +55,7 @@ # 0 # UTC - - name: "Configure auto update for RHEL linux family" + - name: "Configure auto update for RHEL 7 linux family" template: src: etc/yum/yum-cron.conf.j2 dest: /etc/yum/yum-cron.conf @@ -66,6 +66,26 @@ - ansible_os_family == "RedHat" - ansible_distribution_major_version == '7' + - name: "Configure auto update for RHEL 8 linux family" + template: + src: etc/dnf/automatic.conf.j2 + dest: /etc/dnf/automatic.conf + owner: root + group: root + mode: 0644 + when: + - ansible_os_family == "RedHat" + - ansible_distribution_major_version == '8' + + - name: enable a timer for dnf-automatic for RHEL 8 linux family + systemd: + name: dnf-automatic.timer + state: started + enabled: yes + when: + - ansible_os_family == "RedHat" + - ansible_distribution_major_version == '8' + # - name: upgrade all packages # package: # name: "*" diff --git a/templates/etc/dnf/automatic.conf b/templates/etc/dnf/automatic.conf new file mode 100644 index 0000000..ed8ecad --- /dev/null +++ b/templates/etc/dnf/automatic.conf @@ -0,0 +1,81 @@ +[commands] +# What kind of upgrade to perform: +# default = all available upgrades +# security = only the security upgrades +upgrade_type = default +random_sleep = 0 + +# To just receive updates use dnf-automatic-notifyonly.timer + +# Whether updates should be downloaded when they are available, by +# dnf-automatic.timer. notifyonly.timer, download.timer and +# install.timer override this setting. +download_updates = yes + +# Whether updates should be applied when they are available, by +# dnf-automatic.timer. notifyonly.timer, download.timer and +# install.timer override this setting. +apply_updates = yes + + +[emitters] +# Name to use for this system in messages that are emitted. Default is the +# hostname. +# system_name = my-host + +# How to send messages. Valid options are stdio, email and motd. If +# emit_via includes stdio, messages will be sent to stdout; this is useful +# to have cron send the messages. If emit_via includes email, this +# program will send email itself according to the configured options. +# If emit_via includes motd, /etc/motd file will have the messages. if +# emit_via includes command_email, then messages will be send via a shell +# command compatible with sendmail. +# Default is email,stdio. +# If emit_via is None or left blank, no messages will be sent. +emit_via = stdio + + +[email] +# The address to send email messages from. +email_from = root@{{ domain }} + +# List of addresses to send messages to. +email_to = root + +# Name of the host to connect to to send email messages. +email_host = localhost + + +[command] +# The shell command to execute. This is a Python format string, as used in +# str.format(). The format function will pass a shell-quoted argument called +# `body`. +# command_format = "cat" + +# The contents of stdin to pass to the command. It is a format string with the +# same arguments as `command_format`. +# stdin_format = "{body}" + + +[command_email] +# The shell command to use to send email. This is a Python format string, +# as used in str.format(). The format function will pass shell-quoted arguments +# called body, subject, email_from, email_to. +# command_format = "mail -s {subject} -r {email_from} {email_to}" + +# The contents of stdin to pass to the command. It is a format string with the +# same arguments as `command_format`. +# stdin_format = "{body}" + +# The address to send email messages from. +email_from = root@example.com + +# List of addresses to send messages to. +email_to = root + + +[base] +# This section overrides dnf.conf + +# Use this to filter DNF core messages +debuglevel = 1 diff --git a/vars/RedHat_8.yml b/vars/RedHat_8.yml index 6be8e35..b2c2022 100644 --- a/vars/RedHat_8.yml +++ b/vars/RedHat_8.yml @@ -13,7 +13,7 @@ base_packages: - firewalld - kexec-tools # - libcap-ng-utils -# - pigz # epel + - pigz # epel - patch - pciutils - python3-libselinux @@ -23,7 +23,7 @@ base_packages: - usbutils - wget - xz -# - yum-cron + - dnf-automatic base_packages_servers: - "@^minimal-environment"