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

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

View File

@@ -17,10 +17,10 @@ DISCOURSE_REPOSITORY_URL: "{{ applications | get_app_conf(application_id,
## Directories ## Directories
DISCOURSE_REPOSITORY_DIR: "{{ docker_compose.directories.services }}{{ applications | get_app_conf( application_id, 'repository') }}/" 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 ## 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 ## Error Strings
DISCOURSE_ERROR_ALREADY_IN_NET: "Error response from daemon: endpoint with name {{ DISCOURSE_CONTAINER }} already exists in network {{ DISCOURSE_PG_NETWORK }}" 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 - name: enable {{ plugin_key }} nextcloud plugin
command: "{{NEXTCLOUD_DOCKER_EXEC_OCC}} app:enable {{plugin_key}}" command: "{{ NEXTCLOUD_DOCKER_EXEC_OCC }} app:enable {{ plugin_key }}"
register: enable_result register: enable_result
changed_when: enable_result.rc == 0 and ("already enabled" not in enable_result.stdout) 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: stat:
path: "{{nextcloud_control_node_plugin_vars_directory}}{{ plugin_key }}.yml" path: "{{ nextcloud_control_node_plugin_vars_directory }}{{ plugin_key }}.yml"
delegate_to: localhost delegate_to: localhost
become: false become: false
register: plugin_vars_file register: plugin_vars_file
- name: "Load {{ plugin_key }} configuration variables" - name: "Load {{ plugin_key }} configuration variables"
include_vars: 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 when: plugin_vars_file.stat.exists
- name: "Set plugin configuration (batched shell, no async)" - name: "Set plugin configuration (batched shell, no async)"
@@ -35,13 +35,13 @@
async: "{{ ASYNC_TIME if ASYNC_ENABLED | bool else omit }}" async: "{{ ASYNC_TIME if ASYNC_ENABLED | bool else omit }}"
poll: "{{ ASYNC_POLL 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: stat:
path: "{{nextcloud_control_node_plugin_tasks_directory}}{{ plugin_key }}.yml" path: "{{ nextcloud_control_node_plugin_tasks_directory }}{{ plugin_key }}.yml"
delegate_to: localhost delegate_to: localhost
become: false become: false
register: plugin_tasks_file register: plugin_tasks_file
- name: "include {{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" include_tasks: "{{ nextcloud_control_node_plugin_tasks_directory }}{{ plugin_key }}.yml"
when: plugin_tasks_file.stat.exists when: plugin_tasks_file.stat.exists

View File

@@ -3,7 +3,7 @@
command: > command: >
docker exec -u {{ WORDPRESS_USER }} {{ WORDPRESS_CONTAINER }} docker exec -u {{ WORDPRESS_USER }} {{ WORDPRESS_CONTAINER }}
wp core install wp core install
--url="{{ domains | get_url(application_id, WEB_PROTOCOL) }}" --url="{{ WORDPRESS_URL }}"
--title="{{ applications | get_app_conf(application_id, 'title', True) }}" --title="{{ applications | get_app_conf(application_id, 'title', True) }}"
--admin_user="{{ applications | get_app_conf(application_id, 'users.administrator.username') }}" --admin_user="{{ applications | get_app_conf(application_id, 'users.administrator.username') }}"
--admin_password="{{ applications | get_app_conf(application_id, 'credentials.administrator_password', True) }}" --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: stat:
path: "{{ plugin_task_path }}" path: "{{ plugin_task_path }}"
register: plugin_task_file register: plugin_task_file
delegate_to: localhost
become: false
- name: "Include plugin-specific install task if it exists" - name: "Include plugin-specific install task if it exists"
include_tasks: "{{ plugin_task_path }}" include_tasks: "{{ plugin_task_path }}"

View File

@@ -15,16 +15,18 @@
vars: vars:
docker_compose_flush_handlers: false docker_compose_flush_handlers: false
- name: "Transfering upload.ini to {{ docker_compose.directories.instance }}" - name: "Transfering upload.ini to {{ WORDPRESS_CONFIG_UPLD_ABS }}"
template: template:
src: upload.ini.j2 src: upload.ini.j2
dest: "{{ docker_compose.directories.instance }}upload.ini" dest: "{{ WORDPRESS_CONFIG_UPLD_ABS }}"
notify: docker compose up notify:
- docker compose up
- docker compose build
- name: "Transfering msmtprc to {{ WORDPRESS_HOST_MSMTP_CONF }}" - name: "Transfering msmtprc to {{ WORDPRESS_MSMTP_ABS }}"
template: template:
src: "{{ playbook_dir }}/roles/sys-svc-msmtp/templates/msmtprc.conf.j2" src: "{{ WORDPRESS_MSMTP_SRC }}"
dest: "{{ WORDPRESS_HOST_MSMTP_CONF }}" dest: "{{ WORDPRESS_MSMTP_ABS }}"
notify: docker compose up notify: docker compose up
- name: Flush handlers to make {{ WORDPRESS_CONFIG_FILE }} available before patch - name: Flush handlers to make {{ WORDPRESS_CONFIG_FILE }} available before patch
@@ -53,7 +55,7 @@
vars: vars:
plugin_name: "{{ item.key }}" plugin_name: "{{ item.key }}"
plugin_enabled: "{{ item.value.enabled | bool }}" 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 when: plugin_enabled
- name: Detect if WordPress is Multisite - name: Detect if WordPress is Multisite
@@ -68,5 +70,5 @@
when: (wp_is_multisite.stdout | trim) == '0' when: (wp_is_multisite.stdout | trim) == '0'
vars: vars:
# Target URL to switch to (uses your helper) # 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 mv wp-cli.phar /usr/local/bin/wp
# Copy PHP upload settings # 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" - "127.0.0.1:{{ ports.localhost.http[application_id] }}:80"
volumes: volumes:
- data:{{ WORDPRESS_DOCKER_HTML_PATH }} - 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/healthcheck/msmtp_curl.yml.j2' %}
{% include 'roles/docker-container/templates/depends_on/dmbs_excl.yml.j2' %} {% include 'roles/docker-container/templates/depends_on/dmbs_excl.yml.j2' %}

View File

@@ -2,8 +2,10 @@
application_id: "web-app-wordpress" application_id: "web-app-wordpress"
database_type: "mariadb" database_type: "mariadb"
# WordPress Specific # WordPress
WORDPRESS_HOST_MSMTP_CONF: "{{ [ docker_compose.directories.config, 'msmtprc.conf'] | path_join }}" 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_MAX_UPLOAD_SIZE: "{{ applications | get_app_conf(application_id, 'max_upload_size') }}"
WORDPRESS_CUSTOM_IMAGE: "wordpress_custom" WORDPRESS_CUSTOM_IMAGE: "wordpress_custom"
WORDPRESS_DOCKER_HTML_PATH: "/var/www/html" WORDPRESS_DOCKER_HTML_PATH: "/var/www/html"
@@ -17,3 +19,5 @@ WORDPRESS_PLUGINS: "{{ applications | get_app_conf(application_id, 'plu
WORDPRESS_USER: "www-data" WORDPRESS_USER: "www-data"
WORDPRESS_CONFIG_FILE: "wp-config.php" WORDPRESS_CONFIG_FILE: "wp-config.php"
WORDPRESS_CONFIG_PATH: "{{ [WORDPRESS_DOCKER_HTML_PATH, WORDPRESS_CONFIG_FILE] | path_join }}" 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. # 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 # @see https://github.com/oidc-wp/openid-connect-generic/blob/develop/includes/openid-connect-dev-option-settings.php