Populate /etc/yum/vars/contentdir

The file /etc/yum.repos.d/CentOS-QEMU-EV.repo is assuming that
$contentdir is being populated, but it is not until new centos base
images include it.

This change detects the package architecture and populates contentdir
with 'centos' or 'altarch' as appropriate.

There is a kolla change equivalent here Ieb26c0aa65ba3ec1a45a33f87f670e5ecb782f82
The upstream discussion for adding contentdir is here:
https://lists.centos.org/pipermail/centos-devel/2018-March/016542.html

Change-Id: I6279bd4088bd87f37c58b7da25b675c5456506d6
This commit is contained in:
Steve Baker 2018-05-16 09:33:08 +12:00
parent 2673b54f43
commit 11b2c3701a
1 changed files with 26 additions and 0 deletions

View File

@ -25,6 +25,32 @@
dest: /etc/ci/mirror_info.sh
src: mirror_info.sh.j2
- name: Check for /etc/yum/vars/contentdir
stat:
path: /etc/yum/vars/contentdir
register: yum_contentdir
- when: not yum_contentdir.stat.exists
block:
- name: Discover package architecture
command: rpm -q --qf "%{arch}" -f /etc/redhat-release
register: rpm_arch
- debug:
msg: Package architecture is '{{ rpm_arch.stdout }}'
- name: Set contentdir to altarch
set_fact:
yum_contentdir: altarch
when: rpm_arch.stdout in ['aarch64', 'ppc64le']
- name: Populate /etc/yum/vars/contentdir
copy:
dest: /etc/yum/vars/contentdir
content: "{{ yum_contentdir|default('centos') }}"
become: true
- name: Install repos (will be removed by toci_gatetest)
package:
name: "{{ item }}"