Adding wp language files on deploy

It can be more simple.

In finalize-after hook add at the end of block:

  - name: Install WP language es_ES
    command: wp core language install es_ES --activate
    args:
      chdir: "{{ deploy_helper.current_path }}"

  - name: Update active language
    command: wp core language update
    args:
      chdir: "{{ deploy_helper.current_path }}"

And in roles/deploy/defaults/main.yml:

project_shared_children:
  - path: web/app/uploads
    src: uploads
  - path: web/app/languages
    src: languages

Sharing languages folder the install only work on first deploy and on successive deploys is skipped (by wp-cli).
The second task update (currently active) language for updated core/themes/plugins.

2 Likes