Skip to content
Snippets Groups Projects
Commit 4b20477a authored by jurgenhaas's avatar jurgenhaas
Browse files

Implement tasks to copy database and assets from one stage to another

parent 3c8a3de9
No related branches found
No related tags found
No related merge requests found
---
# file: roles/drupal/tasks/copy_data/main.yml
- block:
- name: Set facts without jails
set_fact:
webRoot: /var/www{{ drupal.webRoot|default("") }}
cronUser: root
apacheUser: www-data
apacheLogDir: /var/log/apache2
drushSubkey: '{{ drupal.drush_subkey|default("") }}'
when: drupal.jail is not defined
- name: Set facts with jails
set_fact:
webRoot: '{{ jailroot }}/{{ drupal.jail.name }}/var/www{{ drupal.webRoot|default("") }}'
cronUser: '{{ drupal.jail.name }}'
apacheUser: '{{ drupal.jail.name }}'
apacheLogDir: '{{ jailroot }}/{{ drupal.jail.name }}/var/log/apache2'
drushSubkey: .{{ drupal.jail.name }}
when: drupal.jail is defined
- name: Execute Drush Commands
shell: drush -y {{ item }}
args:
chdir: '{{ webRoot }}'
with_items:
- sql:sync --create-db @{{ drupal.id }}.{{ branch }} @{{ drupal.id }}.{{ destination_branch }}
- rsync @{{ drupal.id }}.{{ branch }}:%files/ @{{ drupal.id }}.{{ destination_branch }}:%files -- --chown={{ apacheUser }}:{{ apacheUser }} --safe-links --max-size=20M
- cr
- updatedb
- config-import sync
- name: Set files ownership
file:
path: '{{ webRoot }}/files'
owner: '{{ apacheUser }}'
group: '{{ apacheUser }}'
mode: ug+rw
recurse: yes
follow: no
tags:
- copy_db_and_assets
......@@ -89,3 +89,14 @@
- collect_asset_archive
when: (not excluded_roles or "drupal" not in excluded_roles) and drupal_install_drupal and collect_download is defined and collect_download
- block:
- name: Copy data from stage to stage
include_tasks: copy_data/main.yml
with_items: '{{ drupal_settings|default([]) }}'
loop_control:
loop_var: drupal
when: siteproject is defined and drupal.siteproject is defined and siteproject == drupal.siteproject and destination_branch == drupal.src.git.branch
tags:
- copy_db_and_assets
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment