octavia/playbooks/image-build/run.yaml
Carlos Goncalves 9df5f75d49 Fix amphora image build jobs
Our periodic amphora image build jobs started failing around mid June
with:

"The conditional check 'install_packages|success' failed. The error was:
template error while templating string: no filter named 'success'.
String: {% if install_packages|success %} True {% else %} False {% endif
%}"

Filters have changed in Ansible 2.9 after a deprecation period.

Additionally, install python3-venv and set virtualenv_command (defaults
to Python 2 "virtualenv") as it seems to be required now too.

Change-Id: I3efa89992cc4a8e2645803dd867d7d2f6e39b966
2020-07-31 06:42:30 +00:00

54 lines
1.5 KiB
YAML

- hosts: all
tasks:
- name: Install apt packages
apt:
pkg: "{{ item }}"
state: "latest"
update_cache: yes
register: install_packages
become: yes
until: install_packages is success
retries: 5
delay: 2
with_items:
- qemu-utils
- uuid-runtime
- curl
- kpartx
- python3-yaml
- debootstrap
- qemu
- bc
- rpm
- yum-utils
- python3-venv
- python3-setuptools
- name: Install required pip packages
pip:
name: "{{ item }}"
state: "latest"
virtualenv: /var/tmp/venv
virtualenv_command: python3 -m venv
register: install_packages
until: install_packages is success
retries: 5
delay: 2
become: yes
with_items:
- diskimage-builder
- name: Ensure artifacts/images directory exists
file:
path: '{{ ansible_user_dir }}/test-images'
state: directory
- name: Build an amphora image for publishing
shell: >-
. /var/tmp/venv/bin/activate && \
./diskimage-create.sh -o {{ ansible_user_dir }}/test-images/test-only-amphora-x64-haproxy-{{ amphora_os }}-{{ amphora_os_release }}.qcow2 \
-i {{ amphora_os }} \
-d {{ amphora_os_release }} \
-s {{ amphora_image_size | default(2) }}
args:
chdir: "{{ ansible_user_dir }}/src/opendev.org/openstack/octavia/diskimage-create"
tags:
- skip_ansible_lint