parent
96863ca261
commit
9e35d8b2a7
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -10,11 +10,13 @@
|
||||||
!/phpstan.neon
|
!/phpstan.neon
|
||||||
!/phpunit.xml.dist
|
!/phpunit.xml.dist
|
||||||
!/scripts/**
|
!/scripts/**
|
||||||
|
!/tools/**
|
||||||
!/web/modules/custom/**
|
!/web/modules/custom/**
|
||||||
!/web/sites/default/environments/settings.*.php
|
!/web/sites/default/environments/settings.*.php
|
||||||
!/web/sites/default/settings.php
|
!/web/sites/default/settings.php
|
||||||
!/web/themes/custom/**
|
!/web/themes/custom/**
|
||||||
/.idea/workspace.xml
|
/.idea/workspace.xml
|
||||||
|
/tools/ansible/.roles/
|
||||||
/vendor/
|
/vendor/
|
||||||
/web/themes/custom/*/body-field-values.txt
|
/web/themes/custom/*/body-field-values.txt
|
||||||
/web/themes/custom/*/dist/
|
/web/themes/custom/*/dist/
|
||||||
|
|
34
tools/ansible/download-database.yml
Normal file
34
tools/ansible/download-database.yml
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
---
|
||||||
|
- name: Download a database
|
||||||
|
|
||||||
|
hosts: all
|
||||||
|
|
||||||
|
vars_files:
|
||||||
|
- vars/vars.yml
|
||||||
|
|
||||||
|
tasks:
|
||||||
|
- name: Generate the name for the export
|
||||||
|
set_fact:
|
||||||
|
export_filename: "~/{{ lookup('pipe', 'date -u +%Y%m%d%H%M%SZ') }}.sql"
|
||||||
|
run_once: true
|
||||||
|
when: export_filename is not defined
|
||||||
|
|
||||||
|
- name: Export the database
|
||||||
|
command:
|
||||||
|
cmd: >
|
||||||
|
../vendor/bin/drush sql-dump
|
||||||
|
--gzip
|
||||||
|
--result-file={{ export_filename }}
|
||||||
|
chdir: "{{ project_root_path }}/{{ ansistrano_current_dir }}/{{ project_web_dir }}"
|
||||||
|
creates: "{{ export_filename }}"
|
||||||
|
|
||||||
|
- name: Fetch the database from the server
|
||||||
|
fetch:
|
||||||
|
src: "{{ export_filename }}.gz"
|
||||||
|
dest: "{{ playbook_dir }}/../../"
|
||||||
|
flat: true
|
||||||
|
|
||||||
|
- name: Remove the export from the server
|
||||||
|
file:
|
||||||
|
path: "{{ export_filename }}.gz"
|
||||||
|
state: absent
|
Loading…
Reference in a new issue