deploy/deploy_db.yml
author ymh <ymh.work@gmail.com>
Wed, 04 Dec 2019 11:40:06 +0100
changeset 0 505fe5249d9c
permissions -rw-r--r--
add foundations for pharmakon (bedrock + deploy)

# 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}}"