deploy/dump_db.yml
changeset 0 505fe5249d9c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/deploy/dump_db.yml	Wed Dec 04 11:40:06 2019 +0100
@@ -0,0 +1,37 @@
+# vendor/bin/wp option delete _site_transient_update_themes
+# vendor/bin/wp option delete _site_transient_theme_roots
+
+- hosts: remote
+  vars:
+    src_dir: "{{playbook_dir}}/build/tmp/rc/src/"
+  tasks:
+
+    - name: create temporary file
+      tempfile:
+        state: file
+        suffix: sql
+      register: sql_tmp_path
+
+    - name: dump and fetch
+      block:
+        - name: dump database
+          command:
+            argv:
+              - "{{remote_path}}/vendor/bin/wp"
+              - db
+              - export
+              - "{{sql_tmp_path.path}}"
+          args:
+            chdir: "{{remote_path}}"
+
+        - name: transfer sql file
+          fetch:
+            src: "{{sql_tmp_path.path}}"
+            dest: "{{db_file_path}}"
+            flat: yes
+      always:
+        - name: delete temporary file
+          file:
+            path: "{{sql_tmp_path.path}}"
+            state: absent
+