Create and use a local LXC RPM repo
CentOS deployments require a special COPR repository for modern LXC
packages. The COPR repository isn't mirrored at this time and this
causes failed gate tests and production deployments.
The role now syncs the LXC packages down from COPR to each host and
builds a local LXC package repository in `/opt/thm-lxc2.0`. This
greatly reduces the amount of times that packages must be downloaded
from the COPR server during deployments, which will reduce failures
until the packages can be hosted with a more reliable source.
In addition, this should speed up playbook runs since ``yum`` can
check a locally-hosted repository instead of a remote repository
with availability and performance challenges.
Partial-Bug: 1730380
Change-Id: I8726b46f4058bb67709246785c7a61278eb64fab
(cherry picked from commit 499eb6fe21
)
This commit is contained in:
parent
23da3f5fff
commit
db037746f2
@ -0,0 +1,16 @@
|
||||
---
|
||||
other:
|
||||
- |
|
||||
CentOS deployments require a special COPR repository for modern LXC
|
||||
packages. The COPR repository is not mirrored at this time and this causes
|
||||
failed gate tests and production deployments.
|
||||
|
||||
The role now syncs the LXC packages down from COPR to each host and builds
|
||||
a local LXC package repository in `/opt/thm-lxc2.0`. This greatly reduces
|
||||
the amount of times that packages must be downloaded from the COPR server
|
||||
during deployments, which will reduce failures until the packages can be
|
||||
hosted with a more reliable source.
|
||||
|
||||
In addition, this should speed up playbook runs since ``yum`` can check a
|
||||
locally-hosted repository instead of a remote repository with availability
|
||||
and performance challenges.
|
@ -13,12 +13,29 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
- name: Deploy COPR yum repo for LXC 2.0
|
||||
- name: Ensure createrepo package is installed
|
||||
yum:
|
||||
name: createrepo
|
||||
state: latest
|
||||
|
||||
- name: Deploy upstream COPR yum repo for LXC 2.0
|
||||
yum_repository:
|
||||
name: thm-lxc2.0
|
||||
description: "COPR repository for LXC 2.0 packages on CentOS 7"
|
||||
baseurl: "{{ lxc_centos_package_baseurl }}"
|
||||
enabled: yes
|
||||
enabled: no
|
||||
gpgcheck: yes
|
||||
gpgkey: "{{ lxc_centos_package_key }}"
|
||||
repo_gpgcheck: no
|
||||
priority: 50
|
||||
state: present
|
||||
|
||||
- name: Deploy local COPR yum repo for LXC 2.0
|
||||
yum_repository:
|
||||
name: thm-lxc2.0-local
|
||||
description: "Local repository for LXC 2.0 packages on CentOS 7"
|
||||
baseurl: "file:///opt/thm-lxc2.0"
|
||||
enabled: no
|
||||
gpgcheck: yes
|
||||
gpgkey: "{{ lxc_centos_package_key }}"
|
||||
repo_gpgcheck: no
|
||||
@ -50,6 +67,14 @@
|
||||
retries: 5
|
||||
delay: 2
|
||||
|
||||
- name: Create and enable local LXC package repository
|
||||
command: "{{ item }}"
|
||||
with_items:
|
||||
- "reposync --repoid=thm-lxc2.0 --download_path=/tmp/"
|
||||
- "createrepo /tmp/thm-lxc2.0"
|
||||
- "rsync -a --delete /tmp/thm-lxc2.0/ /opt/thm-lxc2.0/"
|
||||
- "yum-config-manager --enable thm-lxc2.0-local"
|
||||
|
||||
- name: Install distro packages
|
||||
package:
|
||||
pkg: "{{ lxc_hosts_distro_packages }}"
|
||||
|
@ -60,7 +60,7 @@ lxc_cache_map:
|
||||
{% endfor %}
|
||||
rpm --import /etc/pki/rpm-gpg/*
|
||||
# The containers do not need the LXC repository (only hosts need it).
|
||||
rm -f /etc/yum.repos.d/thm-lxc2.0.repo
|
||||
rm -f /etc/yum.repos.d/thm-lxc2.0*
|
||||
# Prefer dnf over yum for CentOS.
|
||||
which dnf &>/dev/null && RHT_PKG_MGR='dnf' || RHT_PKG_MGR='yum'
|
||||
# Create yum/dnf transaction file and run it all at once
|
||||
|
Loading…
Reference in New Issue
Block a user