Add task to delete and reclone local repos on error

This commit is contained in:
Ethan Paul 2021-03-22 22:29:18 -04:00
parent 94e56ef57c
commit ed8a2f822a
No known key found for this signature in database
GPG Key ID: C5F5542B54A4D9C6

View File

@ -1,14 +1,35 @@
--- ---
- name: Clone repositories - name: Download source
when: item.value.build is defined block:
git: - name: Clone repositories
repo: "{{ item.value.build.repository }}" when: item.value.build is defined
dest: /tmp/{{ item.key }} git:
version: "{{ item.value.build.version }}" repo: "{{ item.value.build.repository }}"
accept_hostkey: true dest: /tmp/{{ item.key }}
loop: "{{ omni_compose_apps | dict2items }}" version: "{{ item.value.build.version }}"
loop_control: accept_hostkey: true
label: "{{ item.key }}" loop: "{{ omni_compose_apps | dict2items }}"
loop_control:
label: "{{ item.key }}"
rescue:
- name: Remove existing repository downloads
file:
path: /tmp/{{ item.key }}
state: absent
loop: "{{ omni_compose_apps | dict2items }}"
loop_control:
label: "{{ item.key }}"
- name: Clone repositories
when: item.value.build is defined
git:
repo: "{{ item.value.build.repository }}"
dest: /tmp/{{ item.key }}
version: "{{ item.value.build.version }}"
accept_hostkey: true
loop: "{{ omni_compose_apps | dict2items }}"
loop_control:
label: "{{ item.key }}"
- name: Build image - name: Build image
when: item.value.build is defined when: item.value.build is defined