| 1 |
- hosts: all |
| 2 |
tasks: |
| 3 |
# Workaround for Red Hat like distros: SELinux prevents diskimage-builder |
| 4 |
# from creating a RPM DB dir in a chroot on Centos 9 Stream |
| 5 |
- name: Disable SELinux on Red Hat distributions |
| 6 |
selinux: |
| 7 |
state: disabled |
| 8 |
become: yes |
| 9 |
when: |
| 10 |
- ansible_os_family == 'RedHat' |
| 11 |
- name: Install required packages on Red Hat distributions |
| 12 |
package: |
| 13 |
name: |
| 14 |
# Required by ansible pip module on centos |
| 15 |
- python3-packaging |
| 16 |
# Required by dib bindep dependencies (gdisk) |
| 17 |
- epel-release |
| 18 |
state: present |
| 19 |
become: yes |
| 20 |
when: |
| 21 |
- ansible_os_family == 'RedHat' |
| 22 |
# Installing epel-release doesn't automatically enable the repository |
| 23 |
- name: Enable EPEL repo on Red Hat distributions |
| 24 |
shell: | |
| 25 |
dnf config-manager --set-enable epel |
| 26 |
become: yes |
| 27 |
when: |
| 28 |
- ansible_os_family == 'RedHat' |
| 29 |
- name: Install required pip packages |
| 30 |
pip: |
| 31 |
name: "{{ item }}" |
| 32 |
state: "latest" |
| 33 |
virtualenv: /var/tmp/venv |
| 34 |
virtualenv_command: python3 -m venv |
| 35 |
register: install_packages |
| 36 |
until: install_packages is success |
| 37 |
retries: 5 |
| 38 |
delay: 2 |
| 39 |
become: yes |
| 40 |
with_items: |
| 41 |
- bindep |
| 42 |
- diskimage-builder |
| 43 |
- setuptools |
| 44 |
- name: Install binary dependencies from diskimage-builder |
| 45 |
include_role: |
| 46 |
name: bindep |
| 47 |
vars: |
| 48 |
bindep_dir: "{{ ansible_user_dir }}/{{ zuul.projects['opendev.org/openstack/diskimage-builder'].src_dir }}" |
| 49 |
- name: Ensure artifacts/images directory exists |
| 50 |
file: |
| 51 |
path: '{{ ansible_user_dir }}/test-images' |
| 52 |
state: directory |
| 53 |
- name: Build an amphora image for publishing |
| 54 |
shell: >- |
| 55 |
. /var/tmp/venv/bin/activate && \ |
| 56 |
./diskimage-create.sh -o {{ ansible_user_dir }}/test-images/test-only-amphora-x64-haproxy-{{ amphora_os }}-{{ amphora_os_release }}.qcow2 \ |
| 57 |
-i {{ amphora_os }} \ |
| 58 |
-d {{ amphora_os_release }} \ |
| 59 |
-s {{ amphora_image_size | default(2) }} |
| 60 |
args: |
| 61 |
chdir: "{{ ansible_user_dir }}/src/opendev.org/openstack/octavia/diskimage-create" |
| 62 |
tags: |
| 63 |
- skip_ansible_lint |