Do not install COPR repo for CentOS LXC

EPEL does contain LXC package for CentOS 8 and 9 Stream, so we can
install LXC from there. For CentOS 9 COPR still needed for lxc-templates

With that we also add control of what packages are going to be installed
from EPEL.

Change-Id: I60f1b04c2378c91905440e8de223c29dd6da4d17
This commit is contained in:
Dmitriy Rabotyagov
2022-05-27 20:19:35 +02:00
committed by Dmitriy Rabotyagov
parent 73c9581299
commit c84b23b258
5 changed files with 25 additions and 32 deletions

View File

@@ -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') }}"

View File

@@ -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.

View File

@@ -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:

View File

@@ -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

View File

@@ -48,9 +48,4 @@ _lxc_cache_distro_packages:
- python3-libs
- setup
- sudo
- systemd
- systemd-resolved
- systemd-networkd
- systemd-sysv
- systemd-udev
- tzdata