diff --git a/tasks/deploy/artefact.yml b/tasks/deploy/artefact.yml new file mode 100644 index 0000000000000000000000000000000000000000..002f2ad2833c4a5ef09b51e9589807c61195c4c0 --- /dev/null +++ b/tasks/deploy/artefact.yml @@ -0,0 +1,25 @@ +--- +# file: roles/drupal/tasks/deploy/artefact.yml + +- block: + + - name: Ensure Repository Directory + file: + path: '{{ tempDeployRoot }}' + state: directory + owner: root + group: root + mode: u+rwX,g+rwX,o+rX + recurse: yes + follow: no + + - name: Create .env file + template: + src: env.jinja2 + dest: '{{ tempDeployRoot }}/.env' + owner: root + group: root + when: drupal.env is defined + + tags: + - deploy diff --git a/tasks/finalize/artefact.yml b/tasks/finalize/artefact.yml new file mode 100644 index 0000000000000000000000000000000000000000..acb8c8584be67fe4246d470be6183493085e0111 --- /dev/null +++ b/tasks/finalize/artefact.yml @@ -0,0 +1,16 @@ +--- +# file: roles/drupal/tasks/finalize/artefact.yml + +- name: Move directories + command: mv /path/to/foo /path/to/bar + 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 }}' diff --git a/tasks/deploy/finalize_d6.yml b/tasks/finalize/d6.yml similarity index 50% rename from tasks/deploy/finalize_d6.yml rename to tasks/finalize/d6.yml index 364296fb90d097cc513450bac187e700b0b845a3..9758474e24b02ad8a40f29b945d9e638976323e6 100644 --- a/tasks/deploy/finalize_d6.yml +++ b/tasks/finalize/d6.yml @@ -1,5 +1,5 @@ --- -# file: roles/drupal/tasks/deploy/finalize_d6.yml +# file: roles/drupal/tasks/finalize/d6.yml - name: Set facts set_fact: diff --git a/tasks/deploy/finalize_d7.yml b/tasks/finalize/d7.yml similarity index 50% rename from tasks/deploy/finalize_d7.yml rename to tasks/finalize/d7.yml index bb46fa8b52d4092f3c66ac3e713b674827ff6983..c257f235092f44b7bff4294ce593321fd53a2310 100644 --- a/tasks/deploy/finalize_d7.yml +++ b/tasks/finalize/d7.yml @@ -1,5 +1,5 @@ --- -# file: roles/drupal/tasks/deploy/finalize_d7.yml +# file: roles/drupal/tasks/finalize/d7.yml - name: Set facts set_fact: diff --git a/tasks/deploy/finalize_d8.yml b/tasks/finalize/d8.yml similarity index 97% rename from tasks/deploy/finalize_d8.yml rename to tasks/finalize/d8.yml index 85682702253857d9833acc2f1a11e44377bce5dd..5cf6bad867c21b2f2f83890faf446c0c527b7bca 100644 --- a/tasks/deploy/finalize_d8.yml +++ b/tasks/finalize/d8.yml @@ -1,5 +1,5 @@ --- -# file: roles/drupal/tasks/deploy/finalize_d8.yml +# file: roles/drupal/tasks/finalize/d8.yml - block: diff --git a/tasks/install.yml b/tasks/install.yml index 5da935bc9b0a4032eb005428dc10d423d943e0b3..96d8002a23bc885d27062fea894b6ebe703c667e 100644 --- a/tasks/install.yml +++ b/tasks/install.yml @@ -37,6 +37,10 @@ filesRoot: '{{ drupalRoot }}/sites' settingsRoot: '{{ drupalRoot }}/sites' when: not drupal.files_outside_root|default(true) + - name: Set facts for artefact mode + set_fact: + tempDeployRoot: '{{ webRoot }}-{{ lookup("pipe","date +%Y-%m-%d-%H-%M-%S") }}' + when: installSource.mode|default("none") == 'artefact' tags: - always @@ -58,6 +62,7 @@ follow: no tags: - deploy + when: installSource.mode|default("none") == 'artefact' - name: Check Installation Requirement shell: ls {{ drupalRoot }}/index.php @@ -95,6 +100,14 @@ tags: - deploy +- name: Copy Artefacts + copy: + src: '{{ DRUPAL_ARTEFACT_SRC }}/' + dest: '{{ (installSource.mode|default("none") == "artefact")|ternary(tempDeployRoot,webRoot) }}/' + when: DRUPAL_ARTEFACT_SRC is defined + tags: + - deploy + - name: Ensure links file: src: '{{ webRoot }}{{ item.src }}' @@ -254,17 +267,15 @@ - deploy when: drush_version_main|default('8') == '9' -- name: Include deploy finalize version - include_tasks: deploy/finalize_{{ drupal.version|default("d7") }}.yml - when: drupal_install_drupal +- name: Include finalize mode + include_tasks: finalize/{{ installSource.mode|default("none") }}.yml + when: drupal_install_drupal and installSource.mode|default("none") == 'artefact' tags: - deploy -- name: Copy Artefacts - copy: - src: '{{ DRUPAL_ARTEFACT_SRC }}/' - dest: '{{ webRoot }}/' - when: DRUPAL_ARTEFACT_SRC is defined +- name: Include finalize version + include_tasks: finalize/{{ drupal.version|default("d7") }}.yml + when: drupal_install_drupal tags: - deploy diff --git a/tasks/install/artefact.yml b/tasks/install/artefact.yml new file mode 100644 index 0000000000000000000000000000000000000000..64bafabd88059fa2d89ed3f52c24d49d85995c38 --- /dev/null +++ b/tasks/install/artefact.yml @@ -0,0 +1,6 @@ +--- +# file: roles/drupal/tasks/install/artefact.yml + +- name: Set facts + set_fact: + dummy: yes diff --git a/tasks/users/artefact.yml b/tasks/users/artefact.yml new file mode 100644 index 0000000000000000000000000000000000000000..28f4e9f4d8acb30fc01b6dc086ae0e2d4b734405 --- /dev/null +++ b/tasks/users/artefact.yml @@ -0,0 +1,6 @@ +--- +# file: roles/drupal/tasks/users/artefact.yml + +- name: Set facts + set_fact: + dummy: yes