deploy/deploy_db.yml
changeset 0 505fe5249d9c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/deploy/deploy_db.yml	Wed Dec 04 11:40:06 2019 +0100
@@ -0,0 +1,119 @@
+# 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}}"
+          - "{{p_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: Set site in french
+      command:
+        argv:
+          - "{{remote_path}}/vendor/bin/wp"
+          - site
+          - switch-language
+          - fr_FR
+      args:
+        chdir: "{{remote_path}}"
+
+
+    - name: update admin password
+      command:
+        argv:
+          - "{{remote_path}}/vendor/bin/wp"
+          - user
+          - update
+          - "{{p_admin_user_id}}"
+          - "--user_pass={{p_admin_user_pswd}}"
+          - --skip-email
+      args:
+        chdir: "{{remote_path}}"
+
+    - name: update admin language
+      command:
+        argv:
+          - "{{remote_path}}/vendor/bin/wp"
+          - user
+          - update
+          - "{{p_admin_user_id}}"
+          - "--locale=en_US"
+          - --skip-email
+      args:
+        chdir: "{{remote_path}}"
+
+    - name: flush cache
+      command:
+        argv:
+          - "{{remote_path}}/vendor/bin/wp"
+          - cache
+          - flush
+      args:
+        chdir: "{{remote_path}}"
+