Fix: Resolved Discourse plugin bug and unified variable/path handling

- Discourse: fixed 'DISCOURSE_CONTAINERS_DIR' and 'DISCOURSE_APPLICATION_YML_DEST'
- Nextcloud: improved plugin enable/configure tasks formatting
- WordPress: unified OIDC, msmtp, and upload.ini variables and tasks
- General: aligned spacing and switched to path_join for consistency
This commit is contained in:
2025-08-29 20:53:36 +02:00
parent db642c1c39
commit b3dfb8bf22
11 changed files with 49 additions and 42 deletions

View File

@@ -1,2 +1,2 @@
system_service_id: sys-ctl-cln-faild-bkps
CLN_FAILED_DOCKER_BACKUPS_PKG: cleanup-failed-docker-backups
system_service_id: sys-ctl-cln-faild-bkps
CLN_FAILED_DOCKER_BACKUPS_PKG: cleanup-failed-docker-backups

View File

@@ -19,7 +19,7 @@
become: true
ignore_errors: true
- name: set chmod 700 for '{{ DISCOURSE_CONTAINERS_DIR}}'
- name: set chmod 700 for '{{ DISCOURSE_CONTAINERS_DIR }}'
ansible.builtin.file:
path: "{{ DISCOURSE_CONTAINERS_DIR }}"
mode: '700'

View File

@@ -17,10 +17,10 @@ DISCOURSE_REPOSITORY_URL: "{{ applications | get_app_conf(application_id,
## Directories
DISCOURSE_REPOSITORY_DIR: "{{ docker_compose.directories.services }}{{ applications | get_app_conf( application_id, 'repository') }}/"
DISCOURSE_CONTAINERS_DIR: "{{ DISCOURSE_REPOSITORY_DIR }}/containers/"
DISCOURSE_CONTAINERS_DIR: "{{ [ DISCOURSE_REPOSITORY_DIR, 'containers' ] | path_join }}"
## Files
DISCOURSE_APPLICATION_YML_DEST: "{{ DISCOURSE_CONTAINERS_DIR }}{{ DISCOURSE_CONTAINER }}.yml"
DISCOURSE_APPLICATION_YML_DEST: "{{ [ DISCOURSE_CONTAINERS_DIR, DISCOURSE_CONTAINER ~ '.yml' ] | path_join }}"
## Error Strings
DISCOURSE_ERROR_ALREADY_IN_NET: "Error response from daemon: endpoint with name {{ DISCOURSE_CONTAINER }} already exists in network {{ DISCOURSE_PG_NETWORK }}"

View File

@@ -1,18 +1,18 @@
- name: enable {{plugin_key}} nextcloud plugin
command: "{{NEXTCLOUD_DOCKER_EXEC_OCC}} app:enable {{plugin_key}}"
- name: enable {{ plugin_key }} nextcloud plugin
command: "{{ NEXTCLOUD_DOCKER_EXEC_OCC }} app:enable {{ plugin_key }}"
register: enable_result
changed_when: enable_result.rc == 0 and ("already enabled" not in enable_result.stdout)
- name: Check if {{nextcloud_control_node_plugin_vars_directory}}{{ plugin_key }}.yml exists
- name: Check if {{ nextcloud_control_node_plugin_vars_directory }}{{ plugin_key }}.yml exists
stat:
path: "{{nextcloud_control_node_plugin_vars_directory}}{{ plugin_key }}.yml"
path: "{{ nextcloud_control_node_plugin_vars_directory }}{{ plugin_key }}.yml"
delegate_to: localhost
become: false
register: plugin_vars_file
- name: "Load {{ plugin_key }} configuration variables"
include_vars:
file: "{{nextcloud_control_node_plugin_vars_directory}}{{ plugin_key }}.yml"
file: "{{ nextcloud_control_node_plugin_vars_directory }}{{ plugin_key }}.yml"
when: plugin_vars_file.stat.exists
- name: "Set plugin configuration (batched shell, no async)"
@@ -35,13 +35,13 @@
async: "{{ ASYNC_TIME if ASYNC_ENABLED | bool else omit }}"
poll: "{{ ASYNC_POLL if ASYNC_ENABLED | bool else omit }}"
- name: Check if {{nextcloud_control_node_plugin_tasks_directory}}{{ plugin_key }}.yml exists
- name: Check if {{ nextcloud_control_node_plugin_tasks_directory }}{{ plugin_key }}.yml exists
stat:
path: "{{nextcloud_control_node_plugin_tasks_directory}}{{ plugin_key }}.yml"
path: "{{ nextcloud_control_node_plugin_tasks_directory }}{{ plugin_key }}.yml"
delegate_to: localhost
become: false
register: plugin_tasks_file
- name: "include {{nextcloud_control_node_plugin_tasks_directory}}{{ plugin_key }}.yml"
include_tasks: "{{nextcloud_control_node_plugin_tasks_directory}}{{ plugin_key }}.yml"
- name: "include {{ nextcloud_control_node_plugin_tasks_directory }}{{ plugin_key }}.yml"
include_tasks: "{{ nextcloud_control_node_plugin_tasks_directory }}{{ plugin_key }}.yml"
when: plugin_tasks_file.stat.exists

View File

@@ -3,7 +3,7 @@
command: >
docker exec -u {{ WORDPRESS_USER }} {{ WORDPRESS_CONTAINER }}
wp core install
--url="{{ domains | get_url(application_id, WEB_PROTOCOL) }}"
--url="{{ WORDPRESS_URL }}"
--title="{{ applications | get_app_conf(application_id, 'title', True) }}"
--admin_user="{{ applications | get_app_conf(application_id, 'users.administrator.username') }}"
--admin_password="{{ applications | get_app_conf(application_id, 'credentials.administrator_password', True) }}"

View File

@@ -1,8 +1,10 @@
---
- name: "Check if plugin has a dedicated install task"
- name: "Check if plugin has a dedicated install task under '{{ plugin_task_path }}'"
stat:
path: "{{ plugin_task_path }}"
register: plugin_task_file
delegate_to: localhost
become: false
- name: "Include plugin-specific install task if it exists"
include_tasks: "{{ plugin_task_path }}"

View File

@@ -15,16 +15,18 @@
vars:
docker_compose_flush_handlers: false
- name: "Transfering upload.ini to {{ docker_compose.directories.instance }}"
- name: "Transfering upload.ini to {{ WORDPRESS_CONFIG_UPLD_ABS }}"
template:
src: upload.ini.j2
dest: "{{ docker_compose.directories.instance }}upload.ini"
notify: docker compose up
dest: "{{ WORDPRESS_CONFIG_UPLD_ABS }}"
notify:
- docker compose up
- docker compose build
- name: "Transfering msmtprc to {{ WORDPRESS_HOST_MSMTP_CONF }}"
- name: "Transfering msmtprc to {{ WORDPRESS_MSMTP_ABS }}"
template:
src: "{{ playbook_dir }}/roles/sys-svc-msmtp/templates/msmtprc.conf.j2"
dest: "{{ WORDPRESS_HOST_MSMTP_CONF }}"
src: "{{ WORDPRESS_MSMTP_SRC }}"
dest: "{{ WORDPRESS_MSMTP_ABS }}"
notify: docker compose up
- name: Flush handlers to make {{ WORDPRESS_CONFIG_FILE }} available before patch
@@ -53,7 +55,7 @@
vars:
plugin_name: "{{ item.key }}"
plugin_enabled: "{{ item.value.enabled | bool }}"
plugin_task_path: "{{ role_path }}/tasks/plugins/{{ plugin_name }}/install.yml"
plugin_task_path: "{{ [role_path, 'tasks/plugins', plugin_name ~ '.yml' ] | path_join }}"
when: plugin_enabled
- name: Detect if WordPress is Multisite
@@ -68,5 +70,5 @@
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) }}"
wp_new_url: "{{ WORDPRESS_URL }}"

View File

@@ -11,4 +11,4 @@ RUN curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli
mv wp-cli.phar /usr/local/bin/wp
# Copy PHP upload settings
COPY upload.ini $PHP_INI_DIR/conf.d/
COPY {{ WORDPRESS_CONFIG_UPLD_REL }} $PHP_INI_DIR/conf.d/

View File

@@ -10,7 +10,7 @@
- "127.0.0.1:{{ ports.localhost.http[application_id] }}:80"
volumes:
- data:{{ WORDPRESS_DOCKER_HTML_PATH }}
- {{ WORDPRESS_HOST_MSMTP_CONF }}:/etc/msmtprc
- {{ WORDPRESS_MSMTP_ABS }}:/etc/msmtprc
{% include 'roles/docker-container/templates/healthcheck/msmtp_curl.yml.j2' %}
{% include 'roles/docker-container/templates/depends_on/dmbs_excl.yml.j2' %}

View File

@@ -2,18 +2,22 @@
application_id: "web-app-wordpress"
database_type: "mariadb"
# WordPress Specific
WORDPRESS_HOST_MSMTP_CONF: "{{ [ docker_compose.directories.config, 'msmtprc.conf'] | path_join }}"
WORDPRESS_MAX_UPLOAD_SIZE: "{{ applications | get_app_conf(application_id, 'max_upload_size') }}"
WORDPRESS_CUSTOM_IMAGE: "wordpress_custom"
WORDPRESS_DOCKER_HTML_PATH: "/var/www/html"
WORDPRESS_DOCKER_CONF_PATH: "{{ WORDPRESS_CONFIG_PATH }}"
WORDPRESS_VERSION: "{{ applications | get_app_conf(application_id, 'docker.services.wordpress.version') }}"
WORDPRESS_IMAGE: "{{ applications | get_app_conf(application_id, 'docker.services.wordpress.image') }}"
WORDPRESS_CONTAINER: "{{ applications | get_app_conf(application_id, 'docker.services.wordpress.name') }}"
WORDPRESS_VOLUME: "{{ applications | get_app_conf(application_id, 'docker.volumes.data') }}"
WORDPRESS_DOMAINS: "{{ applications | get_app_conf(application_id, 'server.domains.canonical') }}"
WORDPRESS_PLUGINS: "{{ applications | get_app_conf(application_id, 'plugins') | dict2items }}"
WORDPRESS_USER: "www-data"
WORDPRESS_CONFIG_FILE: "wp-config.php"
WORDPRESS_CONFIG_PATH: "{{ [WORDPRESS_DOCKER_HTML_PATH, WORDPRESS_CONFIG_FILE] | path_join }}"
# WordPress
WORDPRESS_URL: "{{ domains | get_url(application_id, WEB_PROTOCOL) }}"
WORDPRESS_MSMTP_SRC: "{{ [ playbook_dir, 'roles/sys-svc-msmtp/templates/msmtprc.conf.j2' ] | path_join }}"
WORDPRESS_MSMTP_ABS: "{{ [ docker_compose.directories.config, 'msmtprc.conf'] | path_join }}"
WORDPRESS_MAX_UPLOAD_SIZE: "{{ applications | get_app_conf(application_id, 'max_upload_size') }}"
WORDPRESS_CUSTOM_IMAGE: "wordpress_custom"
WORDPRESS_DOCKER_HTML_PATH: "/var/www/html"
WORDPRESS_DOCKER_CONF_PATH: "{{ WORDPRESS_CONFIG_PATH }}"
WORDPRESS_VERSION: "{{ applications | get_app_conf(application_id, 'docker.services.wordpress.version') }}"
WORDPRESS_IMAGE: "{{ applications | get_app_conf(application_id, 'docker.services.wordpress.image') }}"
WORDPRESS_CONTAINER: "{{ applications | get_app_conf(application_id, 'docker.services.wordpress.name') }}"
WORDPRESS_VOLUME: "{{ applications | get_app_conf(application_id, 'docker.volumes.data') }}"
WORDPRESS_DOMAINS: "{{ applications | get_app_conf(application_id, 'server.domains.canonical') }}"
WORDPRESS_PLUGINS: "{{ applications | get_app_conf(application_id, 'plugins') | dict2items }}"
WORDPRESS_USER: "www-data"
WORDPRESS_CONFIG_FILE: "wp-config.php"
WORDPRESS_CONFIG_PATH: "{{ [WORDPRESS_DOCKER_HTML_PATH, WORDPRESS_CONFIG_FILE] | path_join }}"
WORDPRESS_CONFIG_UPLD_REL: "config/upload.ini"
WORDPRESS_CONFIG_UPLD_ABS: "{{ [docker_compose.directories.instance, WORDPRESS_CONFIG_UPLD_REL ] | path_join }}"

View File

@@ -1,4 +1,3 @@
# vars/oidc.yml
# Defines OIDC settings for the OpenID Connect Generic plugin, with explanatory comments.
# @see https://github.com/oidc-wp/openid-connect-generic/blob/develop/includes/openid-connect-dev-option-settings.php