|
23 | 23 | mode: "0755"
|
24 | 24 |
|
25 | 25 | - name: "List images with name - {{ community_images_image_spec.name }}"
|
26 |
| - ansible.builtin.command: "openstack image list -f json --name {{ community_images_image_spec.name }}" |
| 26 | + ansible.builtin.command: >- |
| 27 | + {{ community_images_openstack_cli_path }} |
| 28 | + image list -f json |
| 29 | + --name {{ community_images_image_spec.name }} |
27 | 30 | changed_when: false
|
28 | 31 | register: community_images_image_list_cmd
|
29 | 32 |
|
|
39 | 42 | community_images_image_id: "{{ community_images_image_list | map(attribute='ID') | first }}"
|
40 | 43 |
|
41 | 44 | - name: "Fetch pre-existing image - {{ community_images_image_spec.name }}"
|
42 |
| - ansible.builtin.command: "openstack image show -f json {{ community_images_image_id }}" |
| 45 | + ansible.builtin.command: >- |
| 46 | + {{ community_images_openstack_cli_path }} |
| 47 | + image show -f json |
| 48 | + {{ community_images_image_id }} |
43 | 49 | changed_when: false
|
44 | 50 | register: community_images_image_info
|
45 | 51 |
|
|
109 | 115 | # Instead, we use the OpenStack CLI directly
|
110 | 116 | - name: "Upload image - {{ community_images_image_spec.name }}"
|
111 | 117 | ansible.builtin.command: >-
|
112 |
| - openstack image create |
| 118 | + {{ community_images_openstack_cli_path }} image create |
113 | 119 | -f json
|
114 | 120 | --container-format {{ community_images_image_spec.container_format }}
|
115 | 121 | --disk-format {{ community_images_disk_format }}
|
|
145 | 151 |
|
146 | 152 | - name: "Set image visibility - {{ community_images_image_spec.name }}"
|
147 | 153 | ansible.builtin.command: >-
|
148 |
| - openstack image set --{{ community_images_image_visibility }} {{ community_images_image_id }} |
| 154 | + {{ community_images_openstack_cli_path }} |
| 155 | + image set |
| 156 | + --{{ community_images_image_visibility }} |
| 157 | + {{ community_images_image_id }} |
149 | 158 | when: community_images_image_visibility != community_images_image_current_visibility
|
150 | 159 | changed_when: true
|
151 | 160 |
|
152 | 161 | - name: "Set custom properties for image - {{ community_images_image_spec.name }}"
|
153 | 162 | ansible.builtin.command: >-
|
154 |
| - openstack image set |
155 |
| - {%- for property in community_images_custom_properties %} |
| 163 | + {{ community_images_openstack_cli_path }} |
| 164 | + image set |
| 165 | + {%- for property in community_images_custom_properties %} |
156 | 166 | --property {{ property | quote }}
|
157 | 167 | {%- endfor %}
|
158 | 168 | {{ community_images_image_id }}
|
|
163 | 173 | when: "community_images_image_visibility == 'shared'"
|
164 | 174 | block:
|
165 | 175 | - name: "Share image with project - {{ community_images_image_spec.name }}"
|
166 |
| - ansible.builtin.command: "openstack image add project {{ community_images_image_id }} {{ project_id }}" |
| 176 | + ansible.builtin.command: >- |
| 177 | + {{ community_images_openstack_cli_path }} |
| 178 | + image add project |
| 179 | + {{ community_images_image_id }} {{ project_id }} |
167 | 180 | register: community_images_image_add_project
|
168 | 181 | changed_when: community_images_image_add_project.rc == 0
|
169 | 182 | failed_when: >-
|
|
174 | 187 | loop_var: project_id
|
175 | 188 |
|
176 | 189 | - name: "Accept image into project - {{ community_images_image_spec.name }}"
|
177 |
| - ansible.builtin.command: "openstack image set --accept {{ community_images_image_id }}" |
| 190 | + ansible.builtin.command: >- |
| 191 | + {{ community_images_openstack_cli_path }} |
| 192 | + image set |
| 193 | + --accept {{ community_images_image_id }} |
178 | 194 | environment:
|
179 | 195 | OS_CLOUD: "{{ project_key }}"
|
180 | 196 | loop: "{{ community_images_share_projects | map(attribute='key') | list }}"
|
|
0 commit comments