/
finalize-after.yml
37 lines (32 loc) · 1.75 KB
/
finalize-after.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
---
- block:
- name: Remove WordPress transient containing old release path
shell: "{{ project.multisite.enabled | default(false) | ternary('wp network meta delete 1', 'wp option delete') }} _site_transient_theme_roots ||:"
args:
chdir: "{{ deploy_helper.current_path }}"
register: site_transient_theme_roots
changed_when: site_transient_theme_roots.stdout != ''
when: project.update_wp_theme_paths | default(update_wp_theme_paths | default(true)) | bool
- name: Update WP theme paths
command: >
wp option set {{ item[0].item }}
{{ item[1] | regex_replace('.*' + deploy_helper.releases_path + '/[^/]*(.*)', deploy_helper.new_release_path + '\1') }}
{% if project.multisite.enabled | default(false) %} --url={{ item[1].split(' ')[0] }}{% endif %}
args:
chdir: "{{ deploy_helper.current_path }}"
loop: "{{ wp_template_root.results | subelements('stdout_lines', skip_missing=true) }}"
loop_control:
label: "{{ item[0].item }}"
when: project.update_wp_theme_paths | default(update_wp_theme_paths | default(true)) | bool and item[1] is match(deploy_helper.releases_path)
- name: Warn about updating network database.
debug:
msg: "Updating the network database could take a long time with a large number of sites."
when: project.update_db_on_deploy | default(update_db_on_deploy) and project.multisite.enabled | default(false)
- name: Update WP database
command: wp core update-db {{ project.multisite.enabled | default(false) | ternary('--network', '') }}
args:
chdir: "{{ deploy_helper.current_path }}"
when: project.update_db_on_deploy | default(update_db_on_deploy)
when: wp_installed.rc == 0
- name: Reload php-fpm
shell: sudo service php{{ php_version }}-fpm reload