mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-06 10:59:59 +00:00
Add tests/lint/repository/test_task_file_numbering.py: numbered task files use exactly two leading digits, a numbered *_core.yml must be 00_core.yml, per directory the numbers are unique/consecutive and start at 01 (00 with a core file), numbered includes appear in ascending order, and shared helpers live in tasks/utils/ instead of the numbered chain. Apply it across every role: rename NN_core.yml to 00_core.yml with a consecutive down-shift of the siblings, move letter-suffix children into a subdirectory named after their parent task, relocate helpers included from more than one place into tasks/utils/, and update every reference (include_tasks, path_absolute, .ansible-lint-ignore, requirement docs). Legacy narration comments in the touched files are deleted; the upstream xwiki.properties reference block opts out via nocheck. The unused MAILU_IP6_PUBLIC var (only ever named in now-removed comments) is dropped. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
70 lines
2.9 KiB
YAML
70 lines
2.9 KiB
YAML
---
|
|
# Updates WordPress single-site URLs and normalizes DB references.
|
|
# Expects: wp_new_url (passed from main.yml), WORDPRESS_USER/container/docker_html_path.
|
|
|
|
- name: ⬇️ Get current 'home' URL
|
|
shell: >
|
|
container exec -u {{ WORDPRESS_USER }} {{ WORDPRESS_CONTAINER_ADDRESS }}
|
|
wp option get home --path={{ WORDPRESS_DOCKER_HTML_PATH }}
|
|
register: wp_home
|
|
changed_when: false
|
|
failed_when: false
|
|
|
|
- name: ⬇️ Get current 'siteurl'
|
|
shell: >
|
|
container exec -u {{ WORDPRESS_USER }} {{ WORDPRESS_CONTAINER_ADDRESS }}
|
|
wp option get siteurl --path={{ WORDPRESS_DOCKER_HTML_PATH }}
|
|
register: wp_siteurl
|
|
changed_when: false
|
|
failed_when: false
|
|
|
|
- name: 🔄 Update 'home' (if needed)
|
|
vars:
|
|
wp_new_url_norm: "{{ wp_new_url | regex_replace('/+$','') }}"
|
|
wp_home_norm: "{{ wp_home.stdout | regex_replace('/+$','') }}"
|
|
shell: >
|
|
container exec -u {{ WORDPRESS_USER }} {{ WORDPRESS_CONTAINER_ADDRESS }}
|
|
wp option update home "{{ wp_new_url_norm }}" --path={{ WORDPRESS_DOCKER_HTML_PATH }}
|
|
when: wp_home_norm != wp_new_url_norm
|
|
|
|
- name: 🔄 Update 'siteurl' (if needed)
|
|
vars:
|
|
wp_new_url_norm: "{{ wp_new_url | regex_replace('/+$','') }}"
|
|
wp_siteurl_norm: "{{ wp_siteurl.stdout | regex_replace('/+$','') }}"
|
|
shell: >
|
|
container exec -u {{ WORDPRESS_USER }} {{ WORDPRESS_CONTAINER_ADDRESS }}
|
|
wp option update siteurl "{{ wp_new_url_norm }}" --path={{ WORDPRESS_DOCKER_HTML_PATH }}
|
|
when: wp_siteurl_norm != wp_new_url_norm
|
|
|
|
- name: 🔍 Search-replace old → new URLs in DB (single site)
|
|
vars:
|
|
wp_old_url_norm: "{{ wp_home.stdout | regex_replace('/+$','') }}"
|
|
wp_new_url_norm: "{{ wp_new_url | regex_replace('/+$','') }}"
|
|
shell: >
|
|
container exec -u {{ WORDPRESS_USER }} {{ WORDPRESS_CONTAINER_ADDRESS }}
|
|
wp search-replace "{{ wp_old_url_norm }}" "{{ wp_new_url_norm }}"
|
|
--skip-columns=guid --all-tables-with-prefix --precise
|
|
--path={{ WORDPRESS_DOCKER_HTML_PATH }}
|
|
register: wp_sr_domain
|
|
changed_when: "('Success: Made 0 replacements.' not in wp_sr_domain.stdout) | bool"
|
|
|
|
- name: 📐 Normalize scheme to https if needed (http → https)
|
|
vars:
|
|
domain_only: "{{ (wp_new_url | regex_replace('^https?://','')) | regex_replace('/+$','') }}"
|
|
http_url: "http://{{ domain_only }}"
|
|
https_url: "https://{{ domain_only }}"
|
|
shell: >
|
|
container exec -u {{ WORDPRESS_USER }} {{ WORDPRESS_CONTAINER_ADDRESS }}
|
|
wp search-replace "{{ http_url }}" "{{ https_url }}"
|
|
--skip-columns=guid --all-tables-with-prefix --precise
|
|
--path={{ WORDPRESS_DOCKER_HTML_PATH }}
|
|
register: wp_sr_scheme
|
|
changed_when: "('Success: Made 0 replacements.' not in wp_sr_scheme.stdout) | bool"
|
|
when: lookup('tls', application_id, 'enabled') | bool
|
|
|
|
- name: 🚿 Flush caches and rewrite rules
|
|
shell: >
|
|
container exec -u {{ WORDPRESS_USER }} {{ WORDPRESS_CONTAINER_ADDRESS }} bash -lc
|
|
"wp cache flush --path={{ WORDPRESS_DOCKER_HTML_PATH }} &&
|
|
wp rewrite flush --hard --path={{ WORDPRESS_DOCKER_HTML_PATH }}"
|