diff --git a/defaults/main.yml b/defaults/main.yml index 257af400..5d59190d 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -210,16 +210,13 @@ lxc_cache_download_template_options: >- # Locales to populate in the LXC base cache lxc_cache_locales: "{{ _lxc_cache_locales | default(['en_US.UTF-8']) }}" -# Centos EPEL repository options +# EL EPEL repository options lxc_centos_epel_mirror: "{{ centos_epel_mirror | default('http://download.fedoraproject.org/pub/epel') }}" lxc_centos_epel_key: >- {{ centos_epel_key | default('http://download.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-' ~ ansible_facts['distribution_major_version']) }} +lxc_hosts_epel_packages: "{{ _lxc_hosts_epel_packages | default([]) }}" -# LXC must be installed from a COPR repository on CentOS since the version -# provided in EPEL is much too old (1.x). -lxc_centos_package_baseurl: "{{ _lxc_centos_package_baseurl }}" -lxc_centos_package_key: "{{ _lxc_centos_package_key }}" - +# DEB repository options lxc_ubuntu_mirror: "{{ (ansible_facts['architecture'] == 'x86_64') | ternary('http://archive.ubuntu.com/ubuntu', 'http://ports.ubuntu.com/ubuntu-ports') }}" lxc_apt_mirror: "{{ (ansible_facts['distribution'] == 'Ubuntu') | ternary(lxc_ubuntu_mirror, 'http://deb.debian.org/debian') }}" diff --git a/releasenotes/notes/centos_copr-dca96bcade8cfb75.yaml b/releasenotes/notes/centos_copr-dca96bcade8cfb75.yaml new file mode 100644 index 00000000..fa5eca16 --- /dev/null +++ b/releasenotes/notes/centos_copr-dca96bcade8cfb75.yaml @@ -0,0 +1,6 @@ +--- +upgrade: + - | + EL does not need to carry thm COPR repo to install LXC as LXC + is now provided by EPEL. + We remove repository during upgrade and clean dnf metadata. diff --git a/tasks/lxc_install_dnf.yml b/tasks/lxc_install_dnf.yml index 0b0654f8..6002b91b 100644 --- a/tasks/lxc_install_dnf.yml +++ b/tasks/lxc_install_dnf.yml @@ -18,25 +18,17 @@ name: createrepo state: present -- name: Deploy upstream COPR yum repo for lxc 3 +- name: Drop COPR yum repo for lxc ansible.builtin.yum_repository: name: thm-lxc3.0 - description: "Copr repo for lxc3.0 owned by thm" - baseurl: "{{ lxc_centos_package_baseurl }}" - enabled: true - gpgcheck: true - gpgkey: "{{ lxc_centos_package_key }}" - repo_gpgcheck: false - state: present + state: absent + register: repo_removed -- name: Add GPG key for COPR LXC repo - ansible.builtin.rpm_key: - key: "{{ lxc_centos_package_key }}" - state: present - register: add_keys - until: add_keys is success - retries: 5 - delay: 2 +- name: Clean yum metadata # noqa: no-handler + ansible.builtin.command: yum clean metadata + changed_when: false + when: + - repo_removed is changed - name: Download EPEL gpg keys ansible.builtin.get_url: @@ -53,7 +45,7 @@ key: "/etc/pki/rpm-gpg/{{ lxc_centos_epel_key.split('/')[-1] }}" state: present -- name: Install the EPEL repository - Centos-8 +- name: Install the EPEL repository ansible.builtin.yum_repository: name: epel-lxc_hosts baseurl: "{{ lxc_centos_epel_mirror ~ '/' ~ ansible_facts['distribution_major_version'] ~ '/Everything/' ~ ansible_facts['architecture'] }}" @@ -62,11 +54,13 @@ gpgkey: "file:///etc/pki/rpm-gpg/{{ lxc_centos_epel_key.split('/')[-1] }}" enabled: true state: present - includepkgs: "systemd-networkd" + includepkgs: "{{ lxc_hosts_epel_packages | join(' ') }}" register: install_epel_repo until: install_epel_repo is success retries: 5 delay: 2 + when: + - lxc_hosts_epel_packages | length > 0 - name: Install distro packages ansible.builtin.package: diff --git a/vars/redhat-host.yml b/vars/redhat-host.yml index f98bc979..59dbbc33 100644 --- a/vars/redhat-host.yml +++ b/vars/redhat-host.yml @@ -16,8 +16,9 @@ system_config_dir: "/etc/sysconfig" systemd_utils_prefix: "/lib/systemd" -_lxc_centos_package_baseurl: "https://download.copr.fedorainfracloud.org/results/neil/lxc4.0/centos-stream-9-$basearch/" -_lxc_centos_package_key: "https://download.copr.fedorainfracloud.org/results/neil/lxc4.0/pubkey.gpg" +_lxc_hosts_epel_packages: + - lxc* + - python3-lxc # Required rpm packages. _lxc_hosts_distro_packages: @@ -30,7 +31,7 @@ _lxc_hosts_distro_packages: - lxc - lxc-devel - lxc-libs - - lxc-templates-extra # requires lxc-templates + - lxc-templates - policycoreutils-python-utils - procps - python3-lxc diff --git a/vars/redhat.yml b/vars/redhat.yml index b3893fff..347ead21 100644 --- a/vars/redhat.yml +++ b/vars/redhat.yml @@ -48,9 +48,4 @@ _lxc_cache_distro_packages: - python3-libs - setup - sudo - - systemd - - systemd-resolved - - systemd-networkd - - systemd-sysv - - systemd-udev - tzdata