--- # Copyright (C) 2020 Roman Danko # SPDX-License-Identifier: GPL-3.0-or-later - name: (CentOS 7) Tasks for standard kernel block: - name: (CentOS 7) Install EPEL & ELRepo repository yum: name: - epel-release - https://www.elrepo.org/elrepo-release-7.el7.elrepo.noarch.rpm update_cache: true - name: (CentOS 7) Install yum-plugin-elrepo yum: name: yum-plugin-elrepo update_cache: true - name: (CentOS 7) Install WireGuard packages yum: name: - "kmod-wireguard" - "wireguard-tools" state: present when: - wireguard_centos7_installation_method == "standard" - name: (CentOS 7) Ensure WireGuard DKMS package is removed yum: name: - "wireguard-dkms" state: absent - name: (CentOS 7) Tasks for kernel-plus block: - name: (CentOS 7) Install EPEL repository & yum utils yum: name: - epel-release - yum-utils update_cache: true - name: (CentOS 7) Enable CentosPlus repo command: yum-config-manager --setopt=centosplus.includepkgs=kernel-plus --enablerepo=centosplus --save changed_when: false - name: (CentOS 7) Update to kernel-plus replace: path: /etc/sysconfig/kernel regexp: '^DEFAULTKERNEL=kernel$' replace: 'DEFAULTKERNEL=kernel-plus' - name: (CentOS 7) Install WireGuard packages yum: name: - "kernel-plus" - "wireguard-tools" state: present register: centos7_yum_updates - name: (CentOS 7) Reboot Instance to update kernel reboot: reboot_timeout: "{{ wireguard_centos7_kernel_plus_reboot_timeout }}" when: - centos7_yum_updates.changes is defined - centos7_yum_updates.changes.installed|flatten|select('regex', '^kernel-plus$') is any when: - wireguard_centos7_installation_method == "kernel-plus"