Files
computer-playbook/roles/web-app-wordpress/tasks/main.yml
Kevin Veen-Birkenbach e6803e5614 refactor(ansible): normalize include_role syntax and unify host config paths via path_join
- Remove stray spaces after include_role: across many roles to ensure clean YAML and
  consistent linting/formatting.
- Listmonk:
  - Introduce LISTMONK_CONFIG_HOST = [ docker_compose.directories.config, 'config.toml' ] | path_join
  - Use that var in the template task (dest) and the docker-compose volume mount
- Matrix:
  - Build MATRIX_SYNAPSE_CONFIG_PATH_HOST, MATRIX_SYNAPSE_LOG_PATH_HOST, and
    MATRIX_ELEMENT_CONFIG_PATH_HOST via path_join
- Mobilizon:
  - Build mobilizon_host_conf_exs_file via path_join
  - Keep get_app_conf strictness unchanged (defaults to True in our filter), so behavior
    remains strict even though the explicit third arg was dropped
- Simpleicons:
  - Build server.js and package.json host paths via path_join
- Numerous web-app roles (Confluence, Discourse, EspoCRM, Friendica, Funkwhale, Gitea,
  GitLab, Jenkins, Joomla, Listmonk, Mailu, Mastodon, Matomo, Matrix, MediaWiki,
  Mobilizon, Moodle, Nextcloud, OpenProject, Peertube, Pixelfed, Pretix, Roulette Wheel,
  Snipe-IT, Syncope, Taiga, WordPress, XWiki, Yourls) and web-svc roles (coturn,
  libretranslate, simpleicons) updated for consistent include_role formatting

Why:
- path_join avoids double slashes and missing separators across different config roots
- Consistent include_role: formatting improves readability and prevents linter noise

Ref:
- Conversation: https://chatgpt.com/share/68d14711-727c-800f-b454-7dc4c3c1f4cb
2025-09-22 14:55:25 +02:00

75 lines
2.4 KiB
YAML

---
- name: "Include role sys-stk-front-proxy for {{ application_id }}"
include_role:
name: sys-stk-front-proxy
loop: "{{ WORDPRESS_DOMAINS }}"
loop_control:
loop_var: domain
vars:
proxy_extra_configuration: "client_max_body_size {{ WORDPRESS_MAX_UPLOAD_SIZE }};"
http_port: "{{ ports.localhost.http[application_id] }}"
- name: "load docker and db for {{ application_id }}"
include_role:
name: sys-stk-back-stateful
vars:
docker_compose_flush_handlers: false
- name: "Transfering upload.ini to {{ WORDPRESS_CONFIG_UPLD_ABS }}"
template:
src: upload.ini.j2
dest: "{{ WORDPRESS_CONFIG_UPLD_ABS }}"
notify:
- docker compose up
- docker compose build
- name: "Transfering msmtprc to {{ WORDPRESS_MSMTP_ABS }}"
template:
src: "{{ WORDPRESS_MSMTP_SRC }}"
dest: "{{ WORDPRESS_MSMTP_ABS }}"
notify: docker compose up
- name: Flush handlers to make {{ WORDPRESS_CONFIG_FILE }} available before patch
meta: flush_handlers
- name: Check if {{ WORDPRESS_CONFIG_FILE }} exists in WordPress
command: docker exec -u {{ WORDPRESS_USER }} {{ WORDPRESS_CONTAINER }} test -f {{ WORDPRESS_CONFIG_PATH }}
register: wp_config_file_exists
changed_when: false
failed_when: false
- name: Patch WordPress {{ WORDPRESS_CONFIG_FILE }} with updated DB credentials
include_tasks: 01_patch_config.yml
when: wp_config_file_exists.rc == 0
- name: "Install wordpress"
include_tasks: 02_install.yml
- name: "Install and activate WordPress plugins"
block:
- name: "Iterate through WordPress plugins"
include_tasks: 03_enable_plugin.yml
loop: "{{ WORDPRESS_PLUGINS }}"
loop_control:
label: "{{ item.key }}"
vars:
plugin_name: "{{ item.key }}"
plugin_enabled: "{{ item.value.enabled | bool }}"
plugin_task_path: "{{ [role_path, 'tasks/plugins', plugin_name ~ '.yml' ] | path_join }}"
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: "{{ WORDPRESS_URL }}"