From aff5f99c13699f26aeea8ddd05e419105a335e5a Mon Sep 17 00:00:00 2001 From: jurgenhaas <juergen@paragon-es.de> Date: Mon, 27 Jul 2015 17:17:06 +0200 Subject: [PATCH] Break role into drupal, drush --- defaults/main.yml | 14 ++- files/etc_sudoers_d_drush | 2 - files/patches/1305-v6x.patch | 13 --- files/patches/324.patch | 26 ----- files/patches/339.patch | 34 ------- files/patches/637.patch | 13 --- files/usr_local_bin_drush | 8 -- files/var_www_drush_crm_tasks_php | 36 ------- files/var_www_drush_test_php | 3 - files/var_www_drush_truncate_cache_db_php | 8 -- files/var_www_drush_update_translation_php | 12 --- handlers/main.yml | 2 +- tasks/drupal.yml | 81 ++++++++-------- tasks/drush.yml | 76 --------------- tasks/drush_init.yml | 97 ------------------- tasks/install.yml | 44 +++++---- tasks/main.yml | 7 +- templates/aliases_drushrc_php | 10 -- templates/d6_create_alias_links | 4 +- .../{d6_settings_php => d6_settings.php} | 8 +- templates/d7_settings.php | 46 +++++++++ templates/d7_settings_php | 46 --------- templates/etc_apache2_sites_available_vhost | 10 +- templates/etc_drush_host_aliases_drushrc_php | 3 - templates/find_missing_repos | 4 +- templates/{sites_php => sites.php} | 4 +- 26 files changed, 135 insertions(+), 476 deletions(-) delete mode 100644 files/etc_sudoers_d_drush delete mode 100644 files/patches/1305-v6x.patch delete mode 100644 files/patches/324.patch delete mode 100644 files/patches/339.patch delete mode 100644 files/patches/637.patch delete mode 100644 files/usr_local_bin_drush delete mode 100644 files/var_www_drush_crm_tasks_php delete mode 100644 files/var_www_drush_test_php delete mode 100644 files/var_www_drush_truncate_cache_db_php delete mode 100644 files/var_www_drush_update_translation_php delete mode 100644 tasks/drush.yml delete mode 100644 tasks/drush_init.yml delete mode 100644 templates/aliases_drushrc_php rename templates/{d6_settings_php => d6_settings.php} (71%) create mode 100644 templates/d7_settings.php delete mode 100644 templates/d7_settings_php delete mode 100644 templates/etc_drush_host_aliases_drushrc_php rename templates/{sites_php => sites.php} (52%) diff --git a/defaults/main.yml b/defaults/main.yml index 85d7baf..a30c8f4 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -1,10 +1,8 @@ -# Drupal drupal_default_settings: [] -drupal_install_drush: true drupal_install_drupal: true drupal_contrib_subdir: '' drupal_settings: - - root: '{{apache_server_default_root}}' + - root: '{{ apache_server_default_root }}' version: 'd7' templates: [] drush_subkey: '' @@ -12,15 +10,15 @@ drupal_settings: apache_site: false src: mode: 'svn' - url: '{{apache_server_default_svn_target}}' + url: '{{ apache_server_default_svn_target }}' target: 'live' domains: - - domain: '{{inventory_hostname}}.{{internal_domain}}' + - domain: '{{ inventory_hostname }}.{{ internal_domain }}' aliases: [] - shortname: '{{inventory_hostname}}.{{internal_domain}}' - dbname: '{{inventory_hostname}}' + shortname: '{{ inventory_hostname }}.{{ internal_domain }}' + dbname: '{{ inventory_hostname }}' dbprefix: '' - dbhost: '{{drupal_default_settings.dbhost}}' + dbhost: '{{ drupal_default_settings.dbhost }}' protocol: 'http' multidomain: false extra_settings: [] diff --git a/files/etc_sudoers_d_drush b/files/etc_sudoers_d_drush deleted file mode 100644 index 30fc330..0000000 --- a/files/etc_sudoers_d_drush +++ /dev/null @@ -1,2 +0,0 @@ -Runas_Alias OP=www-data -%root ALL = (OP) NOPASSWD: /usr/local/share/drush/drush/drush diff --git a/files/patches/1305-v6x.patch b/files/patches/1305-v6x.patch deleted file mode 100644 index 981a50b..0000000 --- a/files/patches/1305-v6x.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/environment.inc b/environment.inc -index a0f2eab..ba0e2ad 100644 ---- a/environment.inc -+++ b/environment.inc -@@ -653,7 +653,7 @@ function drush_build_drush_command($drush_path = NULL, $php = NULL, $os = NULL, - if (($columns) && ($columns != 80)) { - $environment_variables[] = 'COLUMNS=' . $columns; - } -- $prefix = implode(' ', $environment_variables); -+ $prefix = 'env ' . implode(' ', $environment_variables); - } - } - diff --git a/files/patches/324.patch b/files/patches/324.patch deleted file mode 100644 index 6fcdba8..0000000 --- a/files/patches/324.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 70eeadedfe7705f9e328eb9362a268c9bc2170c7 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?J=C3=BCrgen=20Haas?= <jurgen@paragon-es.de> -Date: Wed, 8 Jan 2014 16:25:53 +0100 -Subject: [PATCH 2/2] Bug fix for #324 - -Fix the multiple-site invoke to take care not to pass "php" and "php-options" in, so that they are not forwarded to remote systems. ---- - includes/drush.inc | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/includes/drush.inc b/includes/drush.inc -index 2d30b22..6170c3b 100644 ---- a/includes/drush.inc -+++ b/includes/drush.inc -@@ -1194,7 +1194,7 @@ function drush_preflight_command_dispatch() { - } - } - $command_name = array_shift($args); -- $multi_options = drush_get_context('cli'); -+ $multi_options = drush_redispatch_get_options(); - $backend_options = array(); - if (drush_get_option('pipe') || drush_get_option('interactive')) { - $backend_options['interactive'] = TRUE; --- -1.8.5.1 - diff --git a/files/patches/339.patch b/files/patches/339.patch deleted file mode 100644 index 80a8805..0000000 --- a/files/patches/339.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 6c74b390556e277c45c19cf4a7d22db96d605a64 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?J=C3=BCrgen=20Haas?= <jurgen@paragon-es.de> -Date: Wed, 8 Jan 2014 16:16:38 +0100 -Subject: [PATCH 1/2] Bug fix for #339 - -Enhances drush_sitealias_local_site_path to first look into the sites.php if present to determine the local site path. ---- - includes/sitealias.inc | 11 ++++++++++- - 1 file changed, 10 insertions(+), 1 deletion(-) - -diff --git a/includes/sitealias.inc b/includes/sitealias.inc -index 2576a41..4f8356e 100644 ---- a/includes/sitealias.inc -+++ b/includes/sitealias.inc -@@ -375,7 +375,16 @@ function drush_sitealias_local_site_path($alias_record) { - - if (isset($alias_record['root']) && !isset($alias_record['remote-host'])) { - if (isset($alias_record['uri'])) { -- $result = ($alias_record['root'] . '/sites/' . drush_sitealias_uri_to_site_dir($alias_record['uri'])); -+ if (file_exists($alias_record['root'] . '/sites/sites.php')) { -+ $sites = array(); -+ include($alias_record['root'] . '/sites/sites.php'); -+ if (array_key_exists($alias_record['uri'], $sites)) { -+ $result = $alias_record['root'] . '/sites/' . $sites[$alias_record['uri']]; -+ } -+ } -+ if (!$result) { -+ $result = ($alias_record['root'] . '/sites/' . drush_sitealias_uri_to_site_dir($alias_record['uri'])); -+ } - $result = realpath($result); - } - if (!$result) { --- -1.8.5.1 diff --git a/files/patches/637.patch b/files/patches/637.patch deleted file mode 100644 index 5e3a6df..0000000 --- a/files/patches/637.patch +++ /dev/null @@ -1,13 +0,0 @@ -*** drushorg 2014-06-03 10:29:02.388386932 +0200 ---- drush 2014-06-03 10:20:28.568386932 +0200 -*************** -*** 45,50 **** ---- 45,53 ---- - # error message is suppressed, but tput cols becomes confused about the - # terminal and prints out the default value (80). -+ if [ -n "$TERM" ] && [ "$TERM" = unknown ] ; then -+ TERM=dumb -+ fi - if [ -z $COLUMNS ] && [ -n "$TERM" ] && [ "$TERM" != dumb ] && [ -n "`which tput`" ] ; then - # Note to cygwin/mingw/msys users: install the ncurses package to get tput command. - # Note to mingw/msys users: there is no precompiled ncurses package. diff --git a/files/usr_local_bin_drush b/files/usr_local_bin_drush deleted file mode 100644 index bdfa281..0000000 --- a/files/usr_local_bin_drush +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash - -if [ $USER = 'www-data' ] - then - /usr/local/share/drush/drush/drush $@ - else - sudo -u www-data /usr/local/share/drush/drush/drush $@ -fi diff --git a/files/var_www_drush_crm_tasks_php b/files/var_www_drush_crm_tasks_php deleted file mode 100644 index f5e686a..0000000 --- a/files/var_www_drush_crm_tasks_php +++ /dev/null @@ -1,36 +0,0 @@ -<?php - -/** - * Script for Drupal-Webservers to grab drush tasks from the CRM and execute them. - * - * @see SV-23907 - */ - -$key = 'sverein_drush_tasks_' . $argv[1]; -$host = $argv[2]; -$port = $argv[3]; -$user = $argv[4]; -$pass = $argv[5]; -$db = $argv[6]; - -$changed = FALSE; -$output = '#!/bin/bash' . PHP_EOL; -try { - $dbh = new PDO('mysql:host='.$host.';port='.$port.';dbname='.$db, $user, $pass, array(PDO::ATTR_PERSISTENT => false)); - foreach ($dbh->query('select * from variable where name="' . $key . '"') as $row) { - $tasks = unserialize($row['value']); - foreach ($tasks as $task) { - $changed = TRUE; - $output .= 'drush -y ' . implode(' ', $task) . PHP_EOL; - } - } - if ($changed) { - $dbh->query('delete from variable where name="' . $key . '"'); - file_put_contents('/tmp/drush.tasks.sh', $output); - chmod('/tmp/drush.tasks.sh', 0755); - exec('/tmp/drush.tasks.sh'); - unlink('/tmp/drush.tasks.sh'); - } -} -catch (Exception $e) {} -exit($changed ? 99 : 0); diff --git a/files/var_www_drush_test_php b/files/var_www_drush_test_php deleted file mode 100644 index a47bda7..0000000 --- a/files/var_www_drush_test_php +++ /dev/null @@ -1,3 +0,0 @@ -<?php - -// Nothing to do diff --git a/files/var_www_drush_truncate_cache_db_php b/files/var_www_drush_truncate_cache_db_php deleted file mode 100644 index d350bd0..0000000 --- a/files/var_www_drush_truncate_cache_db_php +++ /dev/null @@ -1,8 +0,0 @@ -<?php - -// Flush all cache tables in the database, because we're now using Redis -$core = array('cache', 'cache_path', 'cache_filter', 'cache_bootstrap', 'cache_form', 'cache_page'); -$cache_tables = array_merge(module_invoke_all('flush_caches'), $core); -foreach ($cache_tables as $cache_table) { - db_delete($cache_table)->execute(); -} diff --git a/files/var_www_drush_update_translation_php b/files/var_www_drush_update_translation_php deleted file mode 100644 index d649360..0000000 --- a/files/var_www_drush_update_translation_php +++ /dev/null @@ -1,12 +0,0 @@ -<?php - -// Note: much easier is using Drush for this! -// -// $ drush -y @alias l10n-update-refresh -// $ drush -y @alias l10n-update - -if (module_exists('drd_server')) { - module_load_include('inc', 'drd_server', 'drd_server.admin'); - drd_server_admin_update_translation(FALSE); - drupal_get_messages(); -} diff --git a/handlers/main.yml b/handlers/main.yml index ac61e39..6cbb95b 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -2,5 +2,5 @@ # file: roles/drupal/handlers/main.yml - name: "Drupal | Execute script to create sub-directory-links" - shell: /tmp/d6_create_alias_links_{{item.apache_site}} + shell: /tmp/d6_create_alias_links_{{ item.apache_site }} with_items: drupal_settings diff --git a/tasks/drupal.yml b/tasks/drupal.yml index 4718161..9cfb45d 100644 --- a/tasks/drupal.yml +++ b/tasks/drupal.yml @@ -2,29 +2,31 @@ # file: roles/drupal/tasks/drupal.yml - name: "Drupal | Create the sites/sites.php file" - template: src={{item.1.src}} - dest={{item.1.dest}} - owner=www-data - group=www-data - mode=0664 + template: + src={{ item.1.src }} + dest={{ item.1.dest }} + owner=www-data + group=www-data + mode=0664 with_subelements: - drupal_settings - templates - name: "Drupal | Create the sites sub-directories" - file: dest='/var/www/{{item.0.root}}/sites/{{item.1.shortname}}' - state=directory - owner=www-data - group=www-data - mode=555 + file: + dest=/var/www/{{ item.0.root }}/sites/{{ item.1.shortname }} + state=directory + owner=www-data + group=www-data + mode=555 with_subelements: - drupal_settings - domains # TODO: How can we loop over two nested lists? #- name: "Drupal | Create script to create sub-directory-links" -# file: src=/var/www/{{item.0.root}}/sites/{{item.1.shortname}} -# path={{item.2}} +# file: src=/var/www/{{ item.0.root }}/sites/{{ item.1.shortname }} +# path={{ item.2 }} # state=link # with_subelements: # - drupal_settings @@ -33,7 +35,7 @@ # when: item.0.version == 'd6' # template: src='d6_create_alias_links' -# dest='/tmp/d6_create_alias_links_{{item.apache_site}}' +# dest='/tmp/d6_create_alias_links_{{ item.apache_site }}' # owner=root # group=root # mode=500 @@ -43,56 +45,53 @@ # - "Drupal | Execute script to create sub-directory-links" - name: "Drupal | Create the sites file directories" - file: dest='/var/www/{{item.0.root}}/sites/{{item.1.shortname}}/files' - state=directory - owner=www-data - group=www-data - mode=775 + file: + dest=/var/www/{{ item.0.root }}/sites/{{ item.1.shortname }}/files + state=directory + owner=www-data + group=www-data + mode=775 with_subelements: - drupal_settings - domains - name: "Drupal | Create the sites private directories" - file: dest='/var/www/{{item.0.root}}/sites/{{item.1.shortname}}/private' - state=directory - owner=www-data - group=www-data - mode=775 + file: + dest=/var/www/{{ item.0.root }}/sites/{{ item.1.shortname }}/private + state=directory + owner=www-data + group=www-data + mode=775 with_subelements: - drupal_settings - domains - name: "Drupal | Create the settings.php files" - template: src={{item.0.version}}_settings_php - dest=/var/www/{{item.0.root}}/sites/{{item.1.shortname}}/settings.php - owner=www-data - group=www-data - mode=0444 + template: + src={{ item.0.version }}_settings.php + dest=/var/www/{{ item.0.root }}/sites/{{ item.1.shortname }}/settings.php + owner=www-data + group=www-data + mode=0444 with_subelements: - drupal_settings - domains - name: "Drupal | Apache configuration file for our site(s)" - template: src=etc_apache2_sites_available_vhost - dest=/etc/apache2/sites-available/{{item.apache_site}} - owner=root - group=root - mode=0664 + template: + src=etc_apache2_sites_available_vhost + dest=/etc/apache2/sites-available/{{ item.apache_site }} + owner=root + group=root + mode=0664 with_items: drupal_settings when: item.apache_site notify: - "Apache | Restart Apache" - name: "Drupal | Apache enable our new site(s)" - command: a2ensite {{item.apache_site}} creates=/etc/apache2/sites-enabled/{{item.apache_site}} + command: a2ensite {{ item.apache_site }} creates=/etc/apache2/sites-enabled/{{ item.apache_site }} with_items: drupal_settings when: item.apache_site notify: - "Apache | Restart Apache" - -- name: "Drupal | Configure Drush" - include: drush.yml - when: drupal_install_drush - -- name: "Drupal | Update Drupal" - include: update.yml diff --git a/tasks/drush.yml b/tasks/drush.yml deleted file mode 100644 index f0c877b..0000000 --- a/tasks/drush.yml +++ /dev/null @@ -1,76 +0,0 @@ ---- -# file: roles/drupal/tasks/drush.yml - -- name: "Drush | Create alias include file" - template: src=etc_drush_host_aliases_drushrc_php - dest=/etc/drush/{{inventory_hostname}}{{item.drush_subkey}}.aliases.drushrc.php - owner=root - group=root - mode=664 - with_items: drupal_settings - -- name: "Drush | Create alias file" - template: src=aliases_drushrc_php - dest=/var/www/{{item.root}}/sites/aliases.drushrc.php - owner=www-data - group=www-data - mode=0444 - with_items: drupal_settings - when: item.create_drush_aliases - -- name: "Drush | Fetch Alias Files" - fetch: src=/var/www/{{item.root}}/sites/aliases.drushrc.php - dest=/tmp/{{inventory_hostname}}{{item.drush_subkey}}.aliases.drushrc.php - flat=yes - with_items: drupal_settings - tags: DrushUpdateAliases - -- name: "Drush | Add host line to alias file" - local_action: shell echo "foreach (\044aliases as \044key => \044alias) {\044aliases[\044key]['remote-host'] = '{{inventory_hostname}}';}" >>/tmp/{{inventory_hostname}}{{item.drush_subkey}}.aliases.drushrc.php - with_items: drupal_settings - tags: DrushUpdateAliases - -- name: "Drush | Move Alias Files" - local_action: copy - src=/tmp/{{inventory_hostname}}{{item.drush_subkey}}.aliases.drushrc.php - dest=/etc/drush/ - with_items: drupal_settings - tags: DrushUpdateAliases - -- name: "Drush | Install cron for core-cron" - cron: name='Run Drush Cron on @{{inventory_hostname}}{{item.drush_subkey}}' - month='*' - day='*' - hour='*' - minute='0,30' - job='/usr/local/bin/drush -y @{{inventory_hostname}}{{item.drush_subkey}} core-cron >/dev/null 2>&1' - with_items: drupal_settings - -- name: "Drush | Install cron for translation refresh" - cron: name='Run Drush Translation Refresh on @{{inventory_hostname}}{{item.drush_subkey}}' - month='*' - day='*' - weekday='0' - hour='4' - minute='10' - job='/usr/local/bin/drush -y @{{inventory_hostname}}{{item.drush_subkey}} l10n-update-refresh >/dev/null 2>&1' - with_items: drupal_settings - -- name: "Drush | Install cron for translation update" - cron: name='Run Drush Translation Update on @{{inventory_hostname}}{{item.drush_subkey}}' - month='*' - day='*' - weekday='0' - hour='4' - minute='40' - job='/usr/local/bin/drush -y @{{inventory_hostname}}{{item.drush_subkey}} l10n-update >/dev/null 2>&1' - with_items: drupal_settings - -- name: "Drush | Install cron for drush tasks from the CRM" - cron: name='Run Drush Tasks from CRM' - month='*' - day='*' - weekday='*' - hour='*' - minute='*/1' - job='php /var/www/drush/crm_tasks.php {{inventory_hostname}} 127.0.0.1 8011 root root crm >/dev/null 2>&1' diff --git a/tasks/drush_init.yml b/tasks/drush_init.yml deleted file mode 100644 index 6717a53..0000000 --- a/tasks/drush_init.yml +++ /dev/null @@ -1,97 +0,0 @@ ---- -# file: roles/drupal/tasks/drush_init.yml -# -# see: https://drupal.org/project/drush -# -# Interesting extensions: -# - Drush Search & Replace: https://drupal.org/project/sar -# - - -- name: "Drush | Install Packages" - shell: "{{item}}" - with_items: - - 'composer self-update' - - 'composer config --global vendor-dir /usr/local/share' - - 'composer config --global bin-dir /usr/local/bin' - - 'composer global require --no-interaction drush/drush:6.*' - #- 'composer global require drush/drush:7.*' - #- 'composer global property-set minimum-stability dev' - - 'composer global update --no-interaction' - -- name: "Drush | Copy drush script to make sure we run drush as www-data by default" - copy: src=usr_local_bin_drush - dest=/usr/local/bin/drush - owner=root - group=root - mode=755 - -- name: "Drush | Allow sudo runas www-data for the drush script without password" - copy: src=etc_sudoers_d_drush - dest=/etc/sudoers.d/drush - owner=root - group=root - mode=440 - -- name: "Drush | Prepare drush etc directory" - file: dest=/etc/drush - owner=root - group=root - state=directory - mode=775 - -- name: "Drush | Prepare drush scripts directory" - file: dest=/var/www/drush - owner=www-data - group=www-data - state=directory - mode=775 - -- name: "Drush | Install some prepared scripts" - copy: src={{item.src}} - dest=/var/www/drush/{{item.dest}} - owner=www-data - group=www-data - mode=664 - with_items: - - src: var_www_drush_test_php - dest: test.php - - src: var_www_drush_update_translation_php - dest: update_translation.php - - src: var_www_drush_truncate_cache_db_php - dest: truncate_cache_db.php - - src: var_www_drush_crm_tasks_php - dest: crm_tasks.php - -- name: "Drush | Copy some patches" - copy: src=patches/{{item}}.patch - dest=/var/www/drush/{{item}}.patch - owner=root - group=root - mode=664 - with_items: - - '324' - - '339' - - '637' - - '1305-v6x' - -- name: "Drush | Patch core" - command: patch --silent /usr/local/share/drush/drush/{{item.file}} /var/www/drush/{{item.patch}}.patch - with_items: - #- file: 'includes/sitealias.inc' - # patch: '339' - - file: 'includes/drush.inc' - patch: '324' - - file: 'drush' - patch: '637' - - file: 'includes/environment.inc' - patch: '1305-v6x' - ignore_errors: yes - -- name: "Drush | Install some extra commands" - command: /usr/local/share/drush/drush/drush -y --destination=/usr/local/share/drush/drush/commands dl {{item}} - with_items: - - 'drupalgeddon' - - 'drush_sup' - - 'registry_rebuild' - - 'sar' - - 'site_audit' diff --git a/tasks/install.yml b/tasks/install.yml index 6279709..82c4719 100644 --- a/tasks/install.yml +++ b/tasks/install.yml @@ -5,30 +5,33 @@ command: chmod -R g+w /var/www - name: "Drupal | Create script to determine which trees do not yet exist" - template: src='find_missing_repos' - dest='/tmp/find_missing_repos' - owner=root - group=root - mode=700 + template: + src=find_missing_repos + dest=/tmp/find_missing_repos + owner=root + group=root + mode=700 - name: "Drupal | Execute script to determine which trees do not yet exist" shell: /tmp/find_missing_repos register: drupal_missing_repos - name: "Drupal | Prepare Drupal Directories" - file: path='/var/www/{{item.src.target}}' - state=directory - recurse=yes - owner=www-data - group=www-data - mode=775 + file: + path=/var/www/{{ item.src.target }} + state=directory + recurse=yes + owner=www-data + group=www-data + mode=775 with_items: drupal_settings when: item.root in drupal_missing_repos.stdout_lines - name: "Drupal | Install and update Drupal trees from SVN" - subversion: repo='{{item.src.url}}' - dest='/var/www/{{item.src.target}}' - force=yes + subversion: + repo={{ item.src.url }} + dest=/var/www/{{ item.src.target }} + force=yes sudo: no with_items: drupal_settings when: item.root in drupal_missing_repos.stdout_lines and item.src.mode == 'svn' @@ -37,16 +40,17 @@ - "Apache | Change mode for web server files" - name: "Drupal | 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' - owner=www-data - group=www-data - mode=664 + copy: + src={{ inventory_dir }}/files/drush/{{ item.src.makefile }}.make + dest=/var/www/drush/{{ item.src.makefile }}.make + owner=www-data + group=www-data + mode=664 with_items: drupal_settings when: item.src.mode == 'drush' - name: "Drupal | 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}}' + shell: drush make --force-complete '/var/www/drush/{{ item.src.makefile }}.make' . chdir='/var/www/{{ item.root }}' sudo: no with_items: drupal_settings when: item.root in drupal_missing_repos.stdout_lines and item.src.mode == 'drush' diff --git a/tasks/main.yml b/tasks/main.yml index 755cfce..e3ae28e 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,10 +1,6 @@ --- # file: roles/drupal/tasks/main.yml -- name: "Drupal | Install Drush" - include: drush_init.yml - when: drupal_install_drush - - name: "Drupal | Install Drupal" include: install.yml when: drupal_install_drupal @@ -13,3 +9,6 @@ include: drupal.yml when: drupal_install_drupal +- name: "Drupal | Update Drupal" + include: update.yml + when: drupal_install_drupal diff --git a/templates/aliases_drushrc_php b/templates/aliases_drushrc_php deleted file mode 100644 index a8e7a05..0000000 --- a/templates/aliases_drushrc_php +++ /dev/null @@ -1,10 +0,0 @@ -<?php - -$aliases = array( -{% for domain in item.domains %} - '{{domain.shortname}}' => array( - 'uri' => '{{domain.domain}}', - 'root' => '/var/www/{{item.root}}', - ), -{% endfor %} -); diff --git a/templates/d6_create_alias_links b/templates/d6_create_alias_links index 10c4bd4..fc5a97d 100644 --- a/templates/d6_create_alias_links +++ b/templates/d6_create_alias_links @@ -1,9 +1,9 @@ #!/bin/bash -cd /var/www/{{item.root}}/sites +cd /var/www/{{ item.root }}/sites {% for domain in item.domains %} {% for alias in domain.aliases %} -ln -s {{domain.shortname}} {{alias}} +ln -s {{ domain.shortname }} {{ alias }} {% endfor %} {% endfor %} diff --git a/templates/d6_settings_php b/templates/d6_settings.php similarity index 71% rename from templates/d6_settings_php rename to templates/d6_settings.php index abc3af8..0c785fb 100644 --- a/templates/d6_settings_php +++ b/templates/d6_settings.php @@ -1,12 +1,12 @@ <?php -$db_url = 'mysql://root:{{mysql_root_password}}@127.0.0.1/{{item.1.dbname}}'; -$db_prefix = '{{item.1.dbprefix}}'; +$db_url = 'mysql://root:{{ mysql_root_password }}@127.0.0.1/{{ item.1.dbname }}'; +$db_prefix = '{{ item.1.dbprefix }}'; $update_free_access = FALSE; -$base_url = '{{item.1.protocol}}://{{item.1.domain}}'; -$cookie_domain = '{{item.1.domain}}'; +$base_url = '{{ item.1.protocol }}://{{ item.1.domain }}'; +$cookie_domain = '{{ item.1.domain }}'; ini_set('arg_separator.output', '&'); ini_set('magic_quotes_runtime', 0); diff --git a/templates/d7_settings.php b/templates/d7_settings.php new file mode 100644 index 0000000..5a99d02 --- /dev/null +++ b/templates/d7_settings.php @@ -0,0 +1,46 @@ +<?php + +$databases = array ( + 'default' => + array ( + 'default' => + array ( + 'driver' => 'mysql', + 'database' => '{{ item.1.dbname }}', + 'username' => 'root', + 'password' => '{{ mysql_root_password }}', + 'host' => '127.0.0.1', + 'port' => '{{ hostvars[item.1.dbhost]['ssh_tunnel_ports'][0]['local'] }}', + ), + ), +); +$db_prefix = '{{ item.1.dbprefix }}'; + +$update_free_access = FALSE; + +{% if not item.1.multidomain %} +$base_url = '{{ item.1.protocol }}://{{ item.1.domain }}'; +$cookie_domain = '{{ item.1.domain }}'; +{% endif %} + +ini_set('session.gc_probability', 1); +ini_set('session.gc_divisor', 100); +ini_set('session.gc_maxlifetime', 200000); +ini_set('session.cookie_lifetime', 2000000); + +$conf['{{ item.1.protocol }}'] = TRUE; + +$conf['cache_backends'][] = 'sites/all/modules{{ drupal_contrib_subdir }}/redis/redis.autoload.inc'; +$conf['cache_default_class'] = 'Redis_Cache'; +$conf['cache_prefix'] = '{{ item.1.shortname }}_'; +$conf['lock_inc'] = 'sites/all/modules{{ drupal_contrib_subdir }}/redis/redis.lock.inc'; +$conf['path_inc'] = 'sites/all/modules{{ drupal_contrib_subdir }}/redis/redis.path.inc'; +$conf['redis_client_interface'] = 'PhpRedis'; + +{% for line in item.1.extra_settings %} +{{line}} +{% endfor %} + +{% if item.1.multidomain %} +include DRUPAL_ROOT . '/sites/all/modules{{ drupal_contrib_subdir }}/domain/settings.inc'; +{% endif %} diff --git a/templates/d7_settings_php b/templates/d7_settings_php deleted file mode 100644 index d71a6b9..0000000 --- a/templates/d7_settings_php +++ /dev/null @@ -1,46 +0,0 @@ -<?php - -$databases = array ( - 'default' => - array ( - 'default' => - array ( - 'driver' => 'mysql', - 'database' => '{{item.1.dbname}}', - 'username' => 'root', - 'password' => '{{mysql_root_password}}', - 'host' => '127.0.0.1', - 'port' => '{{hostvars[item.1.dbhost]['ssh_tunnel_ports'][0]['local']}}', - ), - ), -); -$db_prefix = '{{item.1.dbprefix}}'; - -$update_free_access = FALSE; - -{% if not item.1.multidomain %} -$base_url = '{{item.1.protocol}}://{{item.1.domain}}'; -$cookie_domain = '{{item.1.domain}}'; -{% endif %} - -ini_set('session.gc_probability', 1); -ini_set('session.gc_divisor', 100); -ini_set('session.gc_maxlifetime', 200000); -ini_set('session.cookie_lifetime', 2000000); - -$conf['{{item.1.protocol}}'] = TRUE; - -$conf['cache_backends'][] = 'sites/all/modules{{drupal_contrib_subdir}}/redis/redis.autoload.inc'; -$conf['cache_default_class'] = 'Redis_Cache'; -$conf['cache_prefix'] = '{{item.1.shortname}}_'; -$conf['lock_inc'] = 'sites/all/modules{{drupal_contrib_subdir}}/redis/redis.lock.inc'; -$conf['path_inc'] = 'sites/all/modules{{drupal_contrib_subdir}}/redis/redis.path.inc'; -$conf['redis_client_interface'] = 'PhpRedis'; - -{% for line in item.1.extra_settings %} -{{line}} -{% endfor %} - -{% if item.1.multidomain %} -include DRUPAL_ROOT . '/sites/all/modules{{drupal_contrib_subdir}}/domain/settings.inc'; -{% endif %} diff --git a/templates/etc_apache2_sites_available_vhost b/templates/etc_apache2_sites_available_vhost index 1d9d6e0..31c1e5c 100644 --- a/templates/etc_apache2_sites_available_vhost +++ b/templates/etc_apache2_sites_available_vhost @@ -1,11 +1,11 @@ <VirtualHost *:80> - ServerAdmin {{apache_server_admin}} - ServerName {{item.domains.0.domain}} - ServerAlias{% for domain in item.domains %} {{domain.domain}}{% for alias in domain.aliases %} {{alias}}{% endfor %}{% endfor %} + ServerAdmin {{ apache_server_admin }} + ServerName {{ item.domains.0.domain }} + ServerAlias{% for domain in item.domains %} {{ domain.domain }}{% for alias in domain.aliases %} {{ alias }}{% endfor %}{% endfor %} - DocumentRoot /var/www/{{item.root}} + DocumentRoot /var/www/{{ item.root }} - <Directory /var/www/{{item.root}}/> + <Directory /var/www/{{ item.root }}/> Options Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny diff --git a/templates/etc_drush_host_aliases_drushrc_php b/templates/etc_drush_host_aliases_drushrc_php deleted file mode 100644 index c67f141..0000000 --- a/templates/etc_drush_host_aliases_drushrc_php +++ /dev/null @@ -1,3 +0,0 @@ -<?php - -include '/var/www/{{item.root}}/sites/aliases.drushrc.php'; diff --git a/templates/find_missing_repos b/templates/find_missing_repos index 196f192..d9597a6 100644 --- a/templates/find_missing_repos +++ b/templates/find_missing_repos @@ -1,8 +1,8 @@ #!/bin/bash {% for domain in drupal_settings %} -if [ ! -d /var/www/{{domain.root}} ] +if [ ! -d /var/www/{{ domain.root }} ] then - echo {{domain.root}} + echo {{ domain.root }} fi {% endfor %} diff --git a/templates/sites_php b/templates/sites.php similarity index 52% rename from templates/sites_php rename to templates/sites.php index 8391040..e9634bd 100644 --- a/templates/sites_php +++ b/templates/sites.php @@ -2,9 +2,9 @@ $sites = array( {% for drupaldomain in item.0.domains %} - '{{drupaldomain.domain}}' => '{{drupaldomain.shortname}}', + '{{ drupaldomain.domain }}' => '{{ drupaldomain.shortname }}', {% for alias in drupaldomain.aliases %} - '{{alias}}' => '{{drupaldomain.shortname}}', + '{{ alias }}' => '{{ drupaldomain.shortname }}', {% endfor %} {% endfor %} ); -- GitLab