Skip to content

Commit 91db1ae

Browse files
authored
Merge pull request #1112 from stackhpc/bugfix/amphora
Fix build and rotation of amphora images on Rocky 9
2 parents a8475a0 + 785eb88 commit 91db1ae

File tree

2 files changed

+26
-11
lines changed

2 files changed

+26
-11
lines changed

etc/kayobe/ansible/octavia-amphora-image-build.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@
44
vars:
55
amphora_dib_upper_constraints_file: "{{ pip_upper_constraints_file }}"
66
tasks:
7+
- name: Install EPEL
8+
package:
9+
name: epel-release
10+
become: true
11+
when:
12+
- ansible_facts.os_family == "RedHat"
13+
- dnf_custom_repos | falsy
14+
715
- name: Ensure packages are installed
816
become: true
917
vars:

etc/kayobe/ansible/octavia-amphora-image-register.yml

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,29 @@
1313
lookup('env', 'OS_USERNAME') != 'octavia' or
1414
lookup('env', 'OS_PROJECT_NAME') != 'service'
1515
16+
- name: Get image checksum
17+
stat:
18+
path: "{{ image_cache_path }}/amphora-x64-haproxy-{{ openstack_release }}.qcow2"
19+
checksum_algorithm: md5
20+
changed_when: false
21+
register: image_checksum
22+
23+
- name: Assert that Amphora image exists
24+
assert:
25+
that: image_checksum.stat.exists
26+
fail_msg: |
27+
The amphora image: {{ image_cache_path }}/amphora-x64-haproxy-{{ openstack_release }}.qcow2
28+
does not exist. Did you build the image?
29+
1630
- name: Set up openstack virtualenv
1731
pip:
1832
virtualenv: "{{ venv }}"
33+
virtualenv_command: python3 -m venv
1934
name:
2035
- openstacksdk
2136
- python-openstackclient
2237
state: latest
23-
extra_args: "{% if pip_upper_constraints_file %}-c {{ pip_upper_constraints_file }}{% endif %}"
38+
extra_args: "{% if openstacksdk_upper_constraints_file %}-c {{ openstacksdk_upper_constraints_file }}{% endif %}"
2439

2540
- name: Query Octavia Amphora image
2641
vars:
@@ -33,23 +48,15 @@
3348
image: amphora-x64-haproxy
3449
register: image_info
3550

36-
- name: Get image checksum
37-
stat:
38-
path: "{{ image_cache_path }}/amphora-x64-haproxy-{{ openstack_release }}.qcow2"
39-
checksum_algorithm: md5
40-
changed_when: false
41-
register: image_checksum
42-
when: image_info.openstack_image
43-
4451
- name: Ensure Octavia Amphora image is renamed
4552
vars:
4653
ansible_python_interpreter: "{{ venv }}/bin/python"
4754
shell:
4855
cmd: >-
4956
{{ venv }}/bin/openstack image set amphora-x64-haproxy --name amphora-x64-haproxy-{{ ansible_facts.date_time.iso8601_basic_short }}
5057
when:
51-
- image_info.openstack_image
52-
- image_info.openstack_image.checksum != image_checksum.stat.checksum
58+
- image_info.image
59+
- image_info.image.checksum != image_checksum.stat.checksum
5360
changed_when: true
5461
environment: "{{ openstack_auth_env }}"
5562

0 commit comments

Comments
 (0)