From d902d53b36f96bcedd50f941029cb0629a392a78 Mon Sep 17 00:00:00 2001 From: Major Hayden Date: Tue, 7 Mar 2017 10:43:03 -0600 Subject: [PATCH] Set higher priority for COPR repo This patch sets the priority for the COPR repository on CentOS 7 (which we use to install LXC) to a higher priority than the default. This ensures we always get our LXC packages from the COPR repo. Change-Id: I07d127cb5fba8f4e30633da88eaecf9228eb350a --- .../copr-repo-priority-60b3603b0c1ff2f7.yaml | 6 ++++++ tasks/lxc_install_yum.yml | 17 +++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 releasenotes/notes/copr-repo-priority-60b3603b0c1ff2f7.yaml diff --git a/releasenotes/notes/copr-repo-priority-60b3603b0c1ff2f7.yaml b/releasenotes/notes/copr-repo-priority-60b3603b0c1ff2f7.yaml new file mode 100644 index 00000000..a68609c4 --- /dev/null +++ b/releasenotes/notes/copr-repo-priority-60b3603b0c1ff2f7.yaml @@ -0,0 +1,6 @@ +--- +features: + - | + The COPR repository for installing LXC on CentOS 7 is now set to a higher + priority than the default to ensure that LXC packages always come from the + COPR repository. diff --git a/tasks/lxc_install_yum.yml b/tasks/lxc_install_yum.yml index 6a0663df..740dfa1f 100644 --- a/tasks/lxc_install_yum.yml +++ b/tasks/lxc_install_yum.yml @@ -22,7 +22,24 @@ gpgcheck: yes gpgkey: "{{ lxc_centos_package_key }}" repo_gpgcheck: no + priority: 50 state: present + register: copr_repository_deploy + +# NOTE: Existing CentOS environments may not have the COPR repo priority set +# higher than the default. The following task ensures that existing +# deployments have their priority adjusted for the COPR repository. +# TODO(mhayden): The ini_file module is required here since the yum_repository +# module can only do add/remove operations, not edits. +# Ansible bug: https://github.com/ansible/ansible/issues/22362 +- name: Ensure COPR repository priority is set + ini_file: + dest: /etc/yum.repos.d/thm-lxc2.0.repo + section: thm-lxc2.0 + option: priority + value: 50 + when: + - not copr_repository_deploy | changed - name: Add GPG key for COPR LXC repo rpm_key: