diff --git a/tasks/finalize/artefact.yml b/tasks/finalize/artefact.yml index cbfbd9c352da4832cfb1118c6c8d79e8d116630d..f41666710d4fe44e1f04c58df614dff5bcd88dad 100644 --- a/tasks/finalize/artefact.yml +++ b/tasks/finalize/artefact.yml @@ -3,19 +3,33 @@ - block: + - name: Set facts + set_fact: + artefact_directories: + - src: '{{ webRoot }}/files' + dest: '{{ tempDeployRoot }}/files' + reset: true + - src: '{{ webRoot }}/settings' + dest: '{{ tempDeployRoot }}/settings' + reset: true + - src: '{{ webRoot }}/web/sites/default' + dest: '{{ tempDeployRoot }}/web/sites/default' + reset: true + - src: '{{ webRoot }}' + dest: '{{ tempDeployRoot }}-old' + - src: '{{ tempDeployRoot }}' + dest: '{{ webRoot }}' + + - name: Reset destination directories + file: + path: '{{ item.dest }}' + state: absent + with_items: '{{ artefact_directories }}' + when: item.reset|default(false) + - name: Move directories command: mv {{ item.src }} {{ item.dest }} - with_items: - - src: '{{ webRoot }}/files' - dest: '{{ tempDeployRoot }}/' - - src: '{{ webRoot }}/settings' - dest: '{{ tempDeployRoot }}/' - - src: '{{ webRoot }}/web/sites/default' - dest: '{{ tempDeployRoot }}/web/sites/' - - src: '{{ webRoot }}' - dest: '{{ webRoot }}-old' - - src: '{{ tempDeployRoot }}' - dest: '{{ webRoot }}' + with_items: '{{ artefact_directories }}' tags: - deploy