blob: b07c9b709c69107616ecd7a2b2689b4b12dcafcb [file] [log] [blame]
Mohammed Naserfef44b12023-01-14 03:36:10 -05001- name: Check if file already exists
2 when: image_manifest_force is false
3 block:
4 - name: Get details about file
5 ansible.builtin.stat:
6 path: "{{ image_manifest_path }}"
7 register: _stat
8
9 - name: Stop if file already exists
10 ansible.builtin.fail:
11 msg: "File {{ image_manifest_path }} already exists, use -e image_manifest_force=true to overwrite"
12 when: _stat.stat.exists
13
14- name: Mirror images
15 when: image_manifest_mirror
Oleksandr Kozachenko39978032023-02-07 04:03:07 +010016 changed_when: false
Mohammed Naserfef44b12023-01-14 03:36:10 -050017 ansible.builtin.command:
18 crane copy {{ atmosphere_images[item] }} {{ image_manifest_data['atmosphere_images'][item] }}
19 loop: |
20 {%- if image_manifest_images is string -%}
21 {{ image_manifest_images | split(',') }}
22 {%- else -%}
23 {{ image_manifest_images }}
24 {%- endif -%}
25
26- name: Write file with image list
27 ansible.builtin.copy:
28 dest: "{{ image_manifest_path }}"
29 content: "{{ image_manifest_data | to_nice_yaml(indent=2) }}"
30 mode: 0644