diff --git a/infrared_plugin/roles/tobiko-ir-run/tasks/main.yaml b/infrared_plugin/roles/tobiko-ir-run/tasks/main.yaml index 8607d6908..9fd36b38b 100644 --- a/infrared_plugin/roles/tobiko-ir-run/tasks/main.yaml +++ b/infrared_plugin/roles/tobiko-ir-run/tasks/main.yaml @@ -66,6 +66,9 @@ - name: apply pre-requisites before tests run include_role: name=tobiko-ir-before-run + - name: "download images" + include_role: name=tobiko-download-images + - name: "initialize test execution" include_role: name=tobiko-configure diff --git a/playbooks/tripleo/pre.yaml b/playbooks/tripleo/pre.yaml index bc39a9ffb..2b9db5c0c 100644 --- a/playbooks/tripleo/pre.yaml +++ b/playbooks/tripleo/pre.yaml @@ -7,6 +7,7 @@ - hosts: primary roles: - tobiko-zuul + - tobiko-download-images - tobiko-configure - ci-common-vars - run-test diff --git a/roles/tobiko-common/defaults/main.yaml b/roles/tobiko-common/defaults/main.yaml index 8f33223c4..d52961dcb 100644 --- a/roles/tobiko-common/defaults/main.yaml +++ b/roles/tobiko-common/defaults/main.yaml @@ -53,3 +53,10 @@ test_log_file: '{{ test_report_dir | realpath }}/tobiko.log' # Local where test cases results are being collected to test_collect_dir: '{{ test_src_dir | realpath }}/{{ test_report_name }}' + +# --- download-images options ------------------------------------------------- +download_images_dir: "{{ ansible_user_dir }}/.downloaded-images" +download_images: + ubuntu-minimal: + type: ubuntu + url: "https://cloud-images.ubuntu.com/minimal/releases/jammy/release/ubuntu-22.04-minimal-cloudimg-amd64.img" diff --git a/roles/tobiko-configure/tasks/main.yaml b/roles/tobiko-configure/tasks/main.yaml index e38b3902d..5d19a3d3e 100644 --- a/roles/tobiko-configure/tasks/main.yaml +++ b/roles/tobiko-configure/tasks/main.yaml @@ -21,6 +21,11 @@ value: "{{ value }}" {% endfor %} {% endfor %} + {% for file_name, dict_value in download_images.items() %} + - section: "{{ dict_value.type }}" + option: image_file + value: "{{ download_images_dir }}/{{ file_name }}" + {% endfor %} vars: sections: "{{ test_default_conf | combine(test_conf, recursive=True) }}" diff --git a/roles/tobiko-download-images/meta/main.yaml b/roles/tobiko-download-images/meta/main.yaml new file mode 100644 index 000000000..0d4361583 --- /dev/null +++ b/roles/tobiko-download-images/meta/main.yaml @@ -0,0 +1,4 @@ +--- + +dependencies: + - role: tobiko-common diff --git a/roles/tobiko-download-images/tasks/main.yaml b/roles/tobiko-download-images/tasks/main.yaml new file mode 100644 index 000000000..a6a8ea624 --- /dev/null +++ b/roles/tobiko-download-images/tasks/main.yaml @@ -0,0 +1,15 @@ +--- + +- name: create directory to store images + file: + state: directory + dest: "{{ download_images_dir }}" + +- name: download images + get_url: + dest: "{{ download_images_dir }}/{{ item.key }}" + url: "{{ item.value.url }}" + register: download + retries: 5 + until: download is success + with_dict: "{{ download_images }}"