From 45f16f8216dd4533cbf2ae5da9562521e0c5b39f Mon Sep 17 00:00:00 2001 From: jurgenhaas <juergen@paragon-es.de> Date: Wed, 11 Nov 2015 13:20:47 +0100 Subject: [PATCH] Improve roles drupal and drush --- defaults/main.yml | 2 ++ tasks/drupal.yml | 2 +- tasks/install.yml | 22 +++++++++++++++++++--- tasks/main.yml | 4 ++-- templates/sites.php | 9 +++++++++ 5 files changed, 33 insertions(+), 6 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index a30c8f4..a168cbe 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -1,5 +1,7 @@ drupal_default_settings: [] drupal_install_drupal: true +drupal_configure_drupal: true +drupal_update_drupal: true drupal_contrib_subdir: '' drupal_settings: - root: '{{ apache_server_default_root }}' diff --git a/tasks/drupal.yml b/tasks/drupal.yml index 9cfb45d..5add091 100644 --- a/tasks/drupal.yml +++ b/tasks/drupal.yml @@ -68,7 +68,7 @@ - name: "Drupal | Create the settings.php files" template: - src={{ item.0.version }}_settings.php + src={{ item.0.template_dir|default('') }}{{ item.0.version }}_settings.php dest=/var/www/{{ item.0.root }}/sites/{{ item.1.shortname }}/settings.php owner=www-data group=www-data diff --git a/tasks/install.yml b/tasks/install.yml index 82c4719..a157d31 100644 --- a/tasks/install.yml +++ b/tasks/install.yml @@ -27,7 +27,7 @@ with_items: drupal_settings when: item.root in drupal_missing_repos.stdout_lines -- name: "Drupal | Install and update Drupal trees from SVN" +- name: "Drupal | SVN | Install and update Drupal trees from SVN" subversion: repo={{ item.src.url }} dest=/var/www/{{ item.src.target }} @@ -39,7 +39,7 @@ - "Apache | Change ownership for web server files" - "Apache | Change mode for web server files" -- name: "Drupal | Copy Drush Make files to the server" +- name: "Drupal | Drush | Copy Drush Make files to the server" copy: src={{ inventory_dir }}/files/drush/{{ item.src.makefile }}.make dest=/var/www/drush/{{ item.src.makefile }}.make @@ -49,7 +49,7 @@ with_items: drupal_settings when: item.src.mode == 'drush' -- name: "Drupal | Install and update Drupal trees from Drush Make" +- name: "Drupal | Drush | Install and update Drupal trees from Drush Make" shell: drush make --force-complete '/var/www/drush/{{ item.src.makefile }}.make' . chdir='/var/www/{{ item.root }}' sudo: no with_items: drupal_settings @@ -58,5 +58,21 @@ - "Apache | Change ownership for web server files" - "Apache | Change mode for web server files" +- name: "Drupal | GitScript | Clone repository" + git: + accept_hostkey: "yes" + repo: "{{ item.src.git.repository }}" + dest: "{{ item.src.git.target }}" + force: "yes" + version: "{{ item.src.git.branch|default(omit) }}" + sudo: false + with_items: drupal_settings + when: item.root in drupal_missing_repos.stdout_lines and item.src.mode == 'gitscript' + +- name: "Drupal | GitScript | Run script" + shell: "{{ item.src.git.target }}/{{ item.src.script }}" + with_items: drupal_settings + when: item.root in drupal_missing_repos.stdout_lines and item.src.mode == 'gitscript' + - name: 'Drupal | Change mode for web server root directory' command: chmod 755 /var/www diff --git a/tasks/main.yml b/tasks/main.yml index e3ae28e..84b728b 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -7,8 +7,8 @@ - name: "Drupal | Configure Drupal" include: drupal.yml - when: drupal_install_drupal + when: drupal_configure_drupal - name: "Drupal | Update Drupal" include: update.yml - when: drupal_install_drupal + when: drupal_update_drupal diff --git a/templates/sites.php b/templates/sites.php index e9634bd..d9d1f65 100644 --- a/templates/sites.php +++ b/templates/sites.php @@ -7,4 +7,13 @@ $sites = array( '{{ alias }}' => '{{ drupaldomain.shortname }}', {% endfor %} {% endfor %} +{% if item.0.sites_extra_domain is defined %} +{% for drupaldomain in item.0.sites_extra_domain %} + '{{ drupaldomain.domain }}' => '{{ drupaldomain.shortname }}', +{% for alias in drupaldomain.aliases %} + '{{ alias }}' => '{{ drupaldomain.shortname }}', +{% endfor %} +{% endfor %} +{% endif %} +//[NEXT] ); -- GitLab