mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-08-29 15:06:26 +02:00
feat(web-app-wordpress): add idempotent single-site domain update via WP-CLI
- New task 04_update_domain.yml updates home/siteurl only when needed - DB-wide search-replace (old → new), GUID-safe, precise, tables-with-prefix - Normalizes http→https, strips trailing slashes, then flushes cache/rewrites - Guarded by is_multisite()==0; multisite untouched - Wired into main.yml with auto target URL via domains|get_url Fixes post-domain-change mixed/CSP issues due to hard-coded old URLs. https://chatgpt.com/share/689bac2d-3610-800f-b6f0-41dc79d13a14
This commit is contained in:
@@ -50,3 +50,18 @@
|
||||
plugin_enabled: "{{ item.value.enabled | bool }}"
|
||||
plugin_task_path: "{{ role_path }}/tasks/plugins/{{ plugin_name }}/install.yml"
|
||||
when: plugin_enabled
|
||||
|
||||
- name: Detect if WordPress is Multisite
|
||||
command: >
|
||||
docker exec -u {{ wordpress_user }} {{ wordpress_container }}
|
||||
wp eval 'echo (int) is_multisite();' --path={{ wordpress_docker_html_path }}
|
||||
register: wp_is_multisite
|
||||
changed_when: false
|
||||
|
||||
- name: "Update Single Side Wordpress domain"
|
||||
include_tasks: 04_update_domain.yml
|
||||
when: (wp_is_multisite.stdout | trim) == '0'
|
||||
vars:
|
||||
# Target URL to switch to (uses your helper)
|
||||
wp_new_url: "{{ domains | get_url(application_id, WEB_PROTOCOL) }}"
|
||||
|
||||
|
Reference in New Issue
Block a user