From 438e946a064074765b8dda560ff0ad5a2bee5bb8 Mon Sep 17 00:00:00 2001 From: Dmitriy Rabotyagov Date: Sat, 20 Jun 2020 10:06:05 +0300 Subject: [PATCH] Add CentOS 8 support Change-Id: I8eb7b1ce7cadc910386cfb8bf1d9b41194b2ecdd --- defaults/main.yml | 2 ++ tasks/main.yml | 18 ++++++++++++++++++ vars/redhat-8.yml | 23 +++++++++++++++++++++++ 3 files changed, 43 insertions(+) create mode 100644 vars/redhat-8.yml diff --git a/defaults/main.yml b/defaults/main.yml index 92f50c0..b8f1d0f 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -157,6 +157,8 @@ systemd_networkd_update_initramfs: "{{ _systemd_networkd_update_initramfs | defa systemd_networkd_distro_packages: "{{ _systemd_networkd_distro_packages | default([]) }}" +systemd_networkd_epel_mirror: "{{ centos_epel_mirror | default('http://download.fedoraproject.org/pub/epel') }}" + # The systemd networkd service can be used to set specific link configuration options. # For more information on all of the possible configuration see # https://www.freedesktop.org/software/systemd/man/systemd.link.html diff --git a/tasks/main.yml b/tasks/main.yml index 275578a..23071fe 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -26,12 +26,30 @@ tags: - always +- name: Install the EPEL repository + yum_repository: + name: epel-networkd + baseurl: "{{ systemd_networkd_epel_mirror ~ '/' ~ ansible_distribution_major_version ~ '/Everything/' ~ ansible_architecture }}" + description: 'Extra Packages for Enterprise Linux $releasever - $basearch' + gpgcheck: yes + enabled: yes + state: present + includepkgs: 'systemd-networkd' + when: + - ansible_os_family | lower == 'redhat' + - ansible_distribution_major_version is version('8', '>=') + register: install_epel_repo + until: install_epel_repo is success + retries: 5 + delay: 2 + - name: Install networkd distro packages package: name: "{{ systemd_networkd_distro_packages }}" state: "present" update_cache: "{{ (ansible_pkg_mgr == 'apt') | ternary('yes', omit) }}" cache_valid_time: "{{ (ansible_pkg_mgr == 'apt') | ternary(600, omit) }}" + enablerepo: "{{ systemd_networkd_enablerepo | default(omit) }}" when: - systemd_networkd_distro_packages | length > 0 register: install_packages diff --git a/vars/redhat-8.yml b/vars/redhat-8.yml new file mode 100644 index 0000000..e8190ba --- /dev/null +++ b/vars/redhat-8.yml @@ -0,0 +1,23 @@ +--- +# Copyright 2020, VEXXHOST Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +_systemd_networkd_distro_packages: + - systemd-networkd + +_systemd_resolved_available: false + +_systemd_networkd_update_initramfs: "dracut -f" + +systemd_networkd_enablerepo: epel