|
13 | 13 | lookup('env', 'OS_USERNAME') != 'octavia' or |
14 | 14 | lookup('env', 'OS_PROJECT_NAME') != 'service' |
15 | 15 |
|
| 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 | +
|
16 | 30 | - name: Set up openstack virtualenv |
17 | 31 | pip: |
18 | 32 | virtualenv: "{{ venv }}" |
| 33 | + virtualenv_command: python3 -m venv |
19 | 34 | name: |
20 | 35 | - openstacksdk |
21 | 36 | - python-openstackclient |
22 | 37 | 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 %}" |
24 | 39 |
|
25 | 40 | - name: Query Octavia Amphora image |
26 | 41 | vars: |
|
33 | 48 | image: amphora-x64-haproxy |
34 | 49 | register: image_info |
35 | 50 |
|
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 | | - |
44 | 51 | - name: Ensure Octavia Amphora image is renamed |
45 | 52 | vars: |
46 | 53 | ansible_python_interpreter: "{{ venv }}/bin/python" |
47 | 54 | shell: |
48 | 55 | cmd: >- |
49 | 56 | {{ venv }}/bin/openstack image set amphora-x64-haproxy --name amphora-x64-haproxy-{{ ansible_facts.date_time.iso8601_basic_short }} |
50 | 57 | 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 |
53 | 60 | changed_when: true |
54 | 61 | environment: "{{ openstack_auth_env }}" |
55 | 62 |
|
|
0 commit comments