deploy/deploy_db.yml
changeset 14 30f2ac9a7656
child 20 36bdc6e0deb1
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/deploy/deploy_db.yml	Fri Jun 14 14:36:17 2019 +0200
@@ -0,0 +1,96 @@
+# 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: transfer sql file
+      copy:
+        src: "{{db_file_path}}"
+        dest: "{{sql_tmp_path.path}}"
+
+    - name: load database
+      command:
+        argv:
+          - "{{remote_path}}/vendor/bin/wp"
+          - db
+          - import
+          - "{{sql_tmp_path.path}}"
+      args:
+        chdir: "{{remote_path}}"
+
+    - name: delete temporary file
+      file:
+        path: "{{sql_tmp_path.path}}"
+        state: absent
+
+    - name: search and replace url
+      command:
+        argv:
+          - "{{remote_path}}/vendor/bin/wp"
+          - search-replace
+          - "{{origin_url}}"
+          - "{{rc_wp_home}}"
+      args:
+        chdir: "{{remote_path}}"
+
+    - name: set template_root
+      command:
+        argv:
+          - "{{remote_path}}/vendor/bin/wp"
+          - option
+          - set
+          - template_root
+          - "{{remote_path}}/web/wp/wp-content/themes"
+      args:
+        chdir: "{{remote_path}}"
+
+    - name: delete _site_transient_update_themes option
+      command:
+        argv:
+          - "{{remote_path}}/vendor/bin/wp"
+          - option
+          - delete
+          - _site_transient_update_themes
+      args:
+        chdir: "{{remote_path}}"
+
+    - name: delete _site_transient_theme_roots option
+      command:
+        argv:
+          - "{{remote_path}}/vendor/bin/wp"
+          - option
+          - delete
+          - _site_transient_theme_roots
+      args:
+        chdir: "{{remote_path}}"
+
+    - name: update admin password
+      command:
+        argv:
+          - "{{remote_path}}/vendor/bin/wp"
+          - user
+          - update
+          - "{{rc_admin_user_id}}"
+          - "--user_pass={{rc_admin_user_pswd}}"
+          - --skip-email
+      args:
+        chdir: "{{remote_path}}"
+
+    - name: flush cache
+      command:
+        argv:
+          - "{{remote_path}}/vendor/bin/wp"
+          - cache
+          - flush
+      args:
+        chdir: "{{remote_path}}"
+