diff --git a/tasks/apache.yml b/tasks/apache.yml index c1e47ff182a5792d4a9832054228347706dd1262..0f515ace685239a0f793d0902c800ea013e80895 100644 --- a/tasks/apache.yml +++ b/tasks/apache.yml @@ -25,7 +25,7 @@ with_items: '{{ drupal_domain.certs|default([]) }}' notify: "Apache | Restart Apache" - - import_tasks: apache_auth.yml + - include_tasks: apache_auth.yml when: drupal_domain.apache_auth is defined tags: 'ApacheConfig' diff --git a/tasks/apache_auth.yml b/tasks/apache_auth.yml index 747e383eae11f85f553dd2d634ac12ef28620c69..c1826cfb54ff5a80b7193e6103976efd79b2b483 100644 --- a/tasks/apache_auth.yml +++ b/tasks/apache_auth.yml @@ -1,19 +1,23 @@ --- # file: roles/drupal/tasks/apache_auth.yml -- name: "Ensure Password Directory" - file: - path='{{ webRoot }}/passwords' - state='directory' - owner='{{ apacheUser }}' - group='{{ apacheUser }}' - mode='755' +- block: -- name: "Setup AuthType Basic" - htpasswd: - path='{{ webRoot }}/passwords/{{ drupal_domain.apache_auth.user }}' - name='{{ drupal_domain.apache_auth.user }}' - password='{{ drupal_domain.apache_auth.password }}' - owner='{{ apacheUser }}' - group='{{ apacheUser }}' - mode='640' + - name: "Ensure Password Directory" + file: + path='{{ webRoot }}/passwords' + state='directory' + owner='{{ apacheUser }}' + group='{{ apacheUser }}' + mode='755' + + - name: "Setup AuthType Basic" + htpasswd: + path='{{ webRoot }}/passwords/{{ drupal_domain.apache_auth.user }}' + name='{{ drupal_domain.apache_auth.user }}' + password='{{ drupal_domain.apache_auth.password }}' + owner='{{ apacheUser }}' + group='{{ apacheUser }}' + mode='640' + + tags: 'ApacheConfig' diff --git a/tasks/deploy/d8.yml b/tasks/deploy/d8.yml index 6ff4927b66b5680170415ab4cf4f9854da1863ac..3e445e422e9b61087090ee2d61c55acb673bda57 100644 --- a/tasks/deploy/d8.yml +++ b/tasks/deploy/d8.yml @@ -1,12 +1,16 @@ --- # file: roles/drupal/tasks/deploy/d8.yml -- name: "Ensure extra directories" - file: - path: '{{ drupalRoot }}{{ item }}' - state: 'directory' - with_items: - - '/modules/custom' - - '/modules/contrib' - - '/themes/custom' - - '/themes/contrib' +- block: + + - name: "Ensure extra directories" + file: + path: '{{ drupalRoot }}{{ item }}' + state: 'directory' + with_items: + - '/modules/custom' + - '/modules/contrib' + - '/themes/custom' + - '/themes/contrib' + + tags: 'deploy' diff --git a/tasks/deploy/finalize_d8.yml b/tasks/deploy/finalize_d8.yml index 5949e3e07f9d41dbd92793f422e84e9f5a995d3a..8f57f2aefdd8a7cbfd431d3b54043e53c569e558 100644 --- a/tasks/deploy/finalize_d8.yml +++ b/tasks/deploy/finalize_d8.yml @@ -1,47 +1,51 @@ --- # file: roles/drupal/tasks/deploy/finalize_d8.yml -- name: "Check for config directory" - stat: path='{{ webRoot }}{{ drupal.configRoot|default("/config") }}' - register: directory - -- block: - - - name: "Ensure site specific config directory" - file: - path: '{{ webRoot }}{{ drupal.configRoot|default("/config") }}/{{ item.shortname|default("default") }}' - state: 'directory' - owner: '{{ apacheUser }}' - group: '{{ apacheUser }}' - mode: '775' - with_items: '{{ drupal.domains }}' - when: item.install|default(true) - - - name: "Link to site specific config directory" - file: - src: '../../..{{ drupal.configRoot|default("/config") }}/{{ item.shortname|default("default") }}' - path: '{{ drupalRoot }}/sites/{{ item.shortname|default("default") }}/files/{{ item.config|default("config") }}' - state: 'link' - force: yes - owner: '{{ apacheUser }}' - group: '{{ apacheUser }}' - with_items: '{{ drupal.domains }}' - when: item.install|default(true) - - when: directory.stat.exists - - block: - - name: "Ensure config directories" - file: - path: '{{ drupalRoot }}/sites/{{ item.0.shortname|default("default") }}/files/{{ item.0.config|default("config") }}/{{ drupal_config_directories[item.1] }}' - state: 'directory' - owner: '{{ apacheUser }}' - group: '{{ apacheUser }}' - mode: '775' - with_nested: - - '{{ drupal.domains }}' - - '{{ drupal_config_directories }}' - when: item.0.install|default(true) - - when: not directory.stat.exists + - name: "Check for config directory" + stat: path='{{ webRoot }}{{ drupal.configRoot|default("/config") }}' + register: directory + + - block: + + - name: "Ensure site specific config directory" + file: + path: '{{ webRoot }}{{ drupal.configRoot|default("/config") }}/{{ item.shortname|default("default") }}' + state: 'directory' + owner: '{{ apacheUser }}' + group: '{{ apacheUser }}' + mode: '775' + with_items: '{{ drupal.domains }}' + when: item.install|default(true) + + - name: "Link to site specific config directory" + file: + src: '../../..{{ drupal.configRoot|default("/config") }}/{{ item.shortname|default("default") }}' + path: '{{ drupalRoot }}/sites/{{ item.shortname|default("default") }}/files/{{ item.config|default("config") }}' + state: 'link' + force: yes + owner: '{{ apacheUser }}' + group: '{{ apacheUser }}' + with_items: '{{ drupal.domains }}' + when: item.install|default(true) + + when: directory.stat.exists + + - block: + + - name: "Ensure config directories" + file: + path: '{{ drupalRoot }}/sites/{{ item.0.shortname|default("default") }}/files/{{ item.0.config|default("config") }}/{{ drupal_config_directories[item.1] }}' + state: 'directory' + owner: '{{ apacheUser }}' + group: '{{ apacheUser }}' + mode: '775' + with_nested: + - '{{ drupal.domains }}' + - '{{ drupal_config_directories }}' + when: item.0.install|default(true) + + when: not directory.stat.exists + + tags: 'deploy' diff --git a/tasks/files.yml b/tasks/files.yml index 196435bc4f0d43e8c853d0ab8cee3027c4e3fd3b..0127f43fad1cc79533746fb1d2b87fd0ca74c19e 100644 --- a/tasks/files.yml +++ b/tasks/files.yml @@ -8,7 +8,7 @@ src='{{ relativeRoot }}/files/{{ drupal_domain.0.shortname|default("default") }}/{{ drupal_domain.1 }}' dest='{{ drupalRoot }}/sites/{{ drupal_domain.0.shortname|default("default") }}/{{ drupal_domain.1 }}' - - import_tasks: files_mount.yml + - include_tasks: files_mount.yml when: drupal_domain.0.mountpoint is defined - name: "Ensure File Directories" diff --git a/tasks/files_mount.yml b/tasks/files_mount.yml index 023c1cf364f4b7ee3a37ddc038d82f87246de76d..4254b9bcc06281a6e6fb6f4194b25285dde18bee 100644 --- a/tasks/files_mount.yml +++ b/tasks/files_mount.yml @@ -1,20 +1,24 @@ --- # file: roles/drupal/tasks/files_mount.yml -- name: "Ensure mounted directory" - file: - path='{{ drupal_domain.0.mountpoint }}/{{ drupal.id }}/{{ drupal_domain.0.shortname|default("default") }}' - state='directory' - owner='{{ apacheUser }}' - group='{{ apacheUser }}' - mode='755' +- block: -- name: "Link webroot to mounted directory" - file: - src='{{ drupal_domain.0.mountpoint }}/{{ drupal.id }}/{{ drupal_domain.0.shortname|default("default") }}' - dest='{{ webRoot }}/files/{{ drupal_domain.0.shortname|default("default") }}' - state='link' - owner='{{ apacheUser }}' - group='{{ apacheUser }}' - mode='755' - force='yes' + - name: "Ensure mounted directory" + file: + path='{{ drupal_domain.0.mountpoint }}/{{ drupal.id }}/{{ drupal_domain.0.shortname|default("default") }}' + state='directory' + owner='{{ apacheUser }}' + group='{{ apacheUser }}' + mode='755' + + - name: "Link webroot to mounted directory" + file: + src='{{ drupal_domain.0.mountpoint }}/{{ drupal.id }}/{{ drupal_domain.0.shortname|default("default") }}' + dest='{{ webRoot }}/files/{{ drupal_domain.0.shortname|default("default") }}' + state='link' + owner='{{ apacheUser }}' + group='{{ apacheUser }}' + mode='755' + force='yes' + + tags: 'SetPermissions' diff --git a/tasks/install.yml b/tasks/install.yml index ae6dc015dd5913fb047fefdc180c4e429d7341e2..2825904294159a5b7877725c37ecc388237041d4 100644 --- a/tasks/install.yml +++ b/tasks/install.yml @@ -61,14 +61,14 @@ - include_tasks: install/{{ installSource.mode|default("none") }}.yml when: drupal_first_installation -- import_tasks: install/{{ drupal.version|default("d7") }}.yml +- include_tasks: install/{{ drupal.version|default("d7") }}.yml when: drupal_first_installation - include_tasks: deploy/{{ installSource.mode|default("none") }}.yml when: drupal_install_drupal tags: 'deploy' -- import_tasks: deploy/{{ drupal.version|default("d7") }}.yml +- include_tasks: deploy/{{ drupal.version|default("d7") }}.yml when: drupal_install_drupal tags: 'deploy' @@ -188,7 +188,7 @@ tags: 'deploy' when: drush_version_main|default('8') == '9' -- import_tasks: deploy/finalize_{{ drupal.version|default("d7") }}.yml +- include_tasks: deploy/finalize_{{ drupal.version|default("d7") }}.yml when: drupal_install_drupal tags: 'deploy' diff --git a/tasks/users/gitscript.yml b/tasks/users/gitscript.yml index 32e78a59db9c3c80a8b704025bfe814f1bc6cf5f..1a54820b6e19e28913766d7dc193146b17003342 100644 --- a/tasks/users/gitscript.yml +++ b/tasks/users/gitscript.yml @@ -24,7 +24,7 @@ - name: "Extended File Modes and Ownership for Repository" command: setfacl -dRm u:root:rwX,g:{{ drupal.src.name }}:rwX,o::rX {{ webRoot }}{{ drupal.src.git.target }} - - import_tasks: gitscript_cron.yml + - include_tasks: gitscript_cron.yml when: drupal.src.cron is defined tags: diff --git a/tasks/users/gitscript_cron.yml b/tasks/users/gitscript_cron.yml index 7ed550cd457701723af7eb9cc7adfb988f921442..0f8778eb3d23842284be65e8b2b6118179e1b9c6 100644 --- a/tasks/users/gitscript_cron.yml +++ b/tasks/users/gitscript_cron.yml @@ -1,22 +1,28 @@ --- # file: roles/drupal/tasks/users/gitscript_cron.yml -- name: "Create Update Script" - template: - src='scripts/update/gitscript.jinja2' - dest='{{ webRoot }}/.update' - owner='root' - group='root' - mode='755' +- block: -- name: "Crontab for Update Script" - cron: - name='Drupal Update {{ drupal.src.name }}' - month='{{ drupal.src.cron.month|default(omit) }}' - day='{{ drupal.src.cron.day|default(omit) }}' - weekday='{{ drupal.src.cron.weekday|default(omit) }}' - hour='{{ drupal.src.cron.hour|default(omit) }}' - minute='{{ drupal.src.cron.minute|default(omit) }}' - job='{{ webRoot }}/.update >>{{ webRoot }}/../log/git-update.log 2>&1' - user='root' - disabled='{{ crons_disabled|default(false) }}' + - name: "Create Update Script" + template: + src='scripts/update/gitscript.jinja2' + dest='{{ webRoot }}/.update' + owner='root' + group='root' + mode='755' + + - name: "Crontab for Update Script" + cron: + name='Drupal Update {{ drupal.src.name }}' + month='{{ drupal.src.cron.month|default(omit) }}' + day='{{ drupal.src.cron.day|default(omit) }}' + weekday='{{ drupal.src.cron.weekday|default(omit) }}' + hour='{{ drupal.src.cron.hour|default(omit) }}' + minute='{{ drupal.src.cron.minute|default(omit) }}' + job='{{ webRoot }}/.update >>{{ webRoot }}/../log/git-update.log 2>&1' + user='root' + disabled='{{ crons_disabled|default(false) }}' + + tags: + - 'SetPermissions' + - 'cron'