|
23 | 23 | path: "{{ community_images_workdir }}"
|
24 | 24 |
|
25 | 25 | - name: "List images with name - {{ community_images_image_spec.name }}"
|
26 |
| - command: "openstack image list -f json --name {{ community_images_image_spec.name }}" |
| 26 | + 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 |
|
|
37 | 40 | community_images_image_id: "{{ community_images_image_list | map(attribute = 'ID') | first }}"
|
38 | 41 |
|
39 | 42 | - name: "Fetch pre-existing image - {{ community_images_image_spec.name }}"
|
40 |
| - command: "openstack image show -f json {{ community_images_image_id }}" |
| 43 | + command: >- |
| 44 | + {{ community_images_openstack_cli_path }} |
| 45 | + image show -f json |
| 46 | + {{ community_images_image_id }} |
41 | 47 | changed_when: false
|
42 | 48 | register: community_images_image_info
|
43 | 49 |
|
|
105 | 111 | # Instead, we use the OpenStack CLI directly
|
106 | 112 | - name: "Upload image - {{ community_images_image_spec.name }}"
|
107 | 113 | command: >-
|
108 |
| - openstack image create |
| 114 | + {{ community_images_openstack_cli_path }} image create |
109 | 115 | -f json
|
110 | 116 | --container-format {{ community_images_image_spec.container_format }}
|
111 | 117 | --disk-format {{ community_images_disk_format }}
|
|
141 | 147 |
|
142 | 148 | - name: "Set image visibility - {{ community_images_image_spec.name }}"
|
143 | 149 | command: >-
|
144 |
| - openstack image set --{{ community_images_image_visibility }} {{ community_images_image_id }} |
| 150 | + {{ community_images_openstack_cli_path }} |
| 151 | + image set |
| 152 | + --{{ community_images_image_visibility }} |
| 153 | + {{ community_images_image_id }} |
145 | 154 | when: community_images_image_visibility != community_images_image_current_visibility
|
146 | 155 |
|
147 | 156 | - name: "Set custom properties for image - {{ community_images_image_spec.name }}"
|
148 | 157 | command: >-
|
149 |
| - openstack image set |
| 158 | + {{ community_images_openstack_cli_path }} |
| 159 | + image set |
150 | 160 | {%- for property in community_images_custom_properties %}
|
151 | 161 | --property {{ property | quote }}
|
152 | 162 | {%- endfor %}
|
|
155 | 165 |
|
156 | 166 | - block:
|
157 | 167 | - name: "Share image with project - {{ community_images_image_spec.name }}"
|
158 |
| - command: "openstack image add project {{ community_images_image_id }} {{ project_id }}" |
| 168 | + command: >- |
| 169 | + {{ community_images_openstack_cli_path }} |
| 170 | + image add project |
| 171 | + {{ community_images_image_id }} {{ project_id }} |
159 | 172 | register: community_images_image_add_project
|
160 | 173 | changed_when: community_images_image_add_project.rc == 0
|
161 | 174 | failed_when: >-
|
|
166 | 179 | loop_var: project_id
|
167 | 180 |
|
168 | 181 | - name: "Accept image into project - {{ community_images_image_spec.name }}"
|
169 |
| - command: "openstack image set --accept {{ community_images_image_id }}" |
| 182 | + command: >- |
| 183 | + {{ community_images_openstack_cli_path }} |
| 184 | + image set |
| 185 | + --accept {{ community_images_image_id }} |
170 | 186 | environment:
|
171 | 187 | OS_CLOUD: "{{ project_key }}"
|
172 | 188 | loop: "{{ community_images_share_projects | map(attribute = 'key') | list }}"
|
|
0 commit comments