tripleo-ci/playbooks/tripleo-buildcontainers/pre.yaml

71 lines
2.5 KiB
YAML

---
- hosts: all
name: TripleO Setup Container Registry and repos mirror
tasks:
- name: Disable EPEL repos with dnf if exists
command: dnf config-manager --set-disabled "epel*"
become: true
changed_when: true
failed_when: false
when:
- ansible_pkg_mgr == "dnf"
- name: Disable EPEL repos with yum if exists
command: yum-config-manager --disable "epel*"
become: true
changed_when: true
failed_when: false
when:
- ansible_pkg_mgr == "yum"
- name: Container Build for 7 specific distros
when: ansible_distribution_major_version is version(7, '==')
block:
- name: Include tripleo-repos
include_role:
name: tripleo-repos
vars:
override_repos: "{{ buildcontainers_override_repos | default('') }}"
tripleo_repos_repository: "{{ ansible_user_dir }}/{{ zuul.projects['opendev.org/openstack/tripleo-repos'].src_dir }}"
# TODO: Move this setting to tripleo-repos yum module
- name: Enable supported container tools version
become: true
shell: |
{{ ansible_pkg_mgr }} module disable container-tools:rhel8 -y;
{{ ansible_pkg_mgr }} module enable container-tools:3.0 -y;
{{ ansible_pkg_mgr }} clean metadata
when: ansible_distribution_major_version is version(8, '==')
# workaround for LP #1950916
- name: Check if /etc/yum.repos.d/CentOS-Stream-AppStream.repo exists
stat:
path: /etc/yum.repos.d/CentOS-Stream-AppStream.repo
register: stat_appstream
- name: Exclude libvirt/qemu from AppStream repo
become: true
lineinfile:
dest: /etc/yum.repos.d/CentOS-Stream-AppStream.repo
line: "exclude=libvirt*,python*libvirt*,qemu*"
when:
- stat_appstream.stat.exists
- release is defined and release in ['master', 'wallaby']
- name: Include bindep role
include_role:
name: bindep
vars:
bindep_dir: "{{ ansible_user_dir }}/{{ zuul.projects['opendev.org/openstack/python-tripleoclient'].src_dir }}"
- name: Setup repos using repo-setup role and release file
when: ansible_distribution_major_version is version(8, '>=')
include_role:
name: tripleo-build-jobs-repos
- name: Run build containers pre tasks
include_role:
name: build-containers
tasks_from: pre