--- # Copyright 2022, BBC R&D # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # We set the python interpreter to the ansible runtime venv if # the delegation is to localhost so that we get access to the # appropriate python libraries in that venv. If the delegation # is to another host, we assume that it is accessible by the # system python instead. - name: Setup the deploy image delegate_to: "{{ ironic_service_setup_host }}" vars: ansible_python_interpreter: "{{ ironic_service_setup_host_python_interpreter }}" block: - name: Create image download directory file: path: "{{ ironic_deploy_image_path }}" state: directory mode: "0750" owner: "{{ ironic_deploy_image_path_owner }}" - name: Download image from artefact server get_url: url: "{{ item['url'] }}" dest: "{{ ironic_deploy_image_path }}" checksum: "sha256:{{ item['sha_url'] }}" mode: "0644" retries: 10 delay: 10 register: ironic_download_results with_items: "{{ ironic_deploy_image_list + ironic_extra_deploy_image_list }}" - name: Upload images openstack.cloud.image: cloud: default endpoint_type: admin name: "{{ item.item.name }}" container_format: "{{ item.item.container_format }}" disk_format: "{{ item.item.disk_format }}" filename: "{{ item.dest }}" with_items: "{{ ironic_download_results.results }}"