Files
computer-playbook/roles/web-app-joomla/tasks/08_oidc_plugin.yml
kevinveenbirkenbachandClaude Opus 5.5 0f7fb92e12 refactor(roles): take seven roles' memory parameters from the container limit
Memcached, Joomla, Moodle, Odoo, Shopware, Snipe-IT and SuiteCRM set
their cache size, PHP memory_limit, OPcache, worker limits and search
heap as literals next to a mem_limit they never read. They now ask
lookup('service_memory_mb') for a share of that limit. The shares are
chosen so every rendered value stays what it was.

Where the parameter lives in a file that cannot hold a template, the
value is handed in: Shopware's init script reads INIT_PHP_MEMORY_LIMIT
and refuses to start without it, SuiteCRM's image takes it as a build
argument. Shopware's worker gets --memory-limit as a command appended
to its entrypoint, and Moodle's OPcache size moves from the static ini
into the rendered one.

The performance.php.memory_limit keys of Joomla and Moodle are gone
from services.yml; nothing else read them.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-06 23:24:22 +02:00

84 lines
4.5 KiB
YAML

---
- name: "📌 Define OIDC plugin paths"
ansible.builtin.set_fact:
JOOMLA_OIDC_PLUGIN_HOST_DIR: "{{ role_path }}/files/joomla-oidc-plugin"
JOOMLA_OIDC_PLUGIN_BUILD_DIR: "/tmp/plg_system_keycloak"
JOOMLA_OIDC_PLUGIN_ZIP: "/tmp/plg_system_keycloak.zip"
- name: "♻️ Reset plugin build dir inside Joomla container"
ansible.builtin.shell: > # nocheck: container-exec-resolver runtime-resolved CID, delegated to the hosting node
container exec {{ JOOMLA_LOCAL_CID | quote }} rm -rf {{ JOOMLA_OIDC_PLUGIN_BUILD_DIR | quote }}
changed_when: false
failed_when: false
delegate_to: "{{ JOOMLA_HOST_NODE }}"
- name: "📋 Stream plugin source into Joomla container"
ansible.builtin.shell: > # nocheck: container-exec-resolver runtime-resolved CID, delegated to the hosting node
base64 -d | container exec -i {{ JOOMLA_LOCAL_CID | quote }}
sh -c 'mkdir -p {{ JOOMLA_OIDC_PLUGIN_BUILD_DIR }} && tar -xzf - -C {{ JOOMLA_OIDC_PLUGIN_BUILD_DIR }}'
args:
stdin: "{{ lookup('pipe', 'tar -C ' ~ ((JOOMLA_OIDC_PLUGIN_HOST_DIR ~ '/plg_system_keycloak') | quote) ~ ' -czf - . | base64') }}"
changed_when: true
delegate_to: "{{ JOOMLA_HOST_NODE }}"
- name: "📦 composer install (vendor jumbojett/openid-connect-php inside container)"
ansible.builtin.shell: >
container exec
-e COMPOSER_HOME=/tmp/composer-home
-e COMPOSER_ALLOW_SUPERUSER=1
{{ JOOMLA_LOCAL_CID | quote }} composer install
--working-dir={{ JOOMLA_OIDC_PLUGIN_BUILD_DIR | quote }}
--no-dev --no-interaction --no-progress --prefer-dist --optimize-autoloader
changed_when: true
delegate_to: "{{ JOOMLA_HOST_NODE }}"
- name: "✅ Ensure Joomla cache directories are writable by the web user" # nocheck: container-exec-resolver runtime-resolved CID, delegated to the hosting node
ansible.builtin.shell: "container exec {{ JOOMLA_LOCAL_CID | quote }} bash -lc 'mkdir -p /var/www/html/administrator/cache /var/www/html/cache /var/www/html/tmp
&& chown -R {{ JOOMLA_WEB_USER }}:{{ JOOMLA_WEB_USER }} /var/www/html/administrator/cache /var/www/html/cache /var/www/html/tmp && chmod -R u+rwX /var/www/html/administrator/cache
/var/www/html/cache /var/www/html/tmp'"
changed_when: false
delegate_to: "{{ JOOMLA_HOST_NODE }}"
- name: "🗜️ Package plugin into a ZIP for Joomla CLI install"
ansible.builtin.shell: >
container exec -i
-e J_ZIP={{ JOOMLA_OIDC_PLUGIN_ZIP | quote }}
-e J_BUILD_DIR={{ JOOMLA_OIDC_PLUGIN_BUILD_DIR | quote }}
{{ JOOMLA_LOCAL_CID | quote }} php --
args:
stdin: "{{ lookup('file', role_path ~ '/files/php/package_plugin.php') }}"
changed_when: true
delegate_to: "{{ JOOMLA_HOST_NODE }}"
- name: "📦 Install plg_system_keycloak via Joomla CLI"
ansible.builtin.shell: > # nocheck: container-exec-resolver runtime-resolved CID, delegated to the hosting node
container exec --user {{ JOOMLA_WEB_USER | quote }} {{ JOOMLA_LOCAL_CID | quote }}
php -d memory_limit={{ JOOMLA_PHP_MEMORY_LIMIT }} {{ JOOMLA_CLI_FILE | quote }}
extension:install --path={{ JOOMLA_OIDC_PLUGIN_ZIP | quote }}
register: plugin_install
changed_when: "'Extension installed successfully' in plugin_install.stdout"
failed_when:
- plugin_install.rc != 0
- plugin_install.stdout | default('') is not search('already')
delegate_to: "{{ JOOMLA_HOST_NODE }}"
- name: "🔍 Resolve plg_system_keycloak extension ID" # nocheck: container-exec-resolver runtime-resolved CID, delegated to the hosting node
ansible.builtin.shell: "container exec --user {{ JOOMLA_WEB_USER }} {{ JOOMLA_LOCAL_CID | quote }} php -d memory_limit={{ JOOMLA_PHP_MEMORY_LIMIT }} {{ JOOMLA_CLI_FILE
}} extension:list | awk '/plg_system_keycloak/ {print $2; exit}'"
register: plugin_id_lookup
changed_when: false
failed_when: plugin_id_lookup.stdout | trim | length == 0
delegate_to: "{{ JOOMLA_HOST_NODE }}"
- name: "🟢 Enable plg_system_keycloak via Joomla CLI"
ansible.builtin.shell: > # nocheck: container-exec-resolver runtime-resolved CID, delegated to the hosting node
container exec --user {{ JOOMLA_WEB_USER | quote }} {{ JOOMLA_LOCAL_CID | quote }}
php -d memory_limit={{ JOOMLA_PHP_MEMORY_LIMIT }} {{ JOOMLA_CLI_FILE | quote }}
extension:enable {{ plugin_id_lookup.stdout | trim | quote }}
register: plugin_enable
changed_when: "'has been enabled' in plugin_enable.stdout or 'enabled successfully' in plugin_enable.stdout"
failed_when:
- plugin_enable.rc != 0
- plugin_enable.stdout | default('') is not search('already')
delegate_to: "{{ JOOMLA_HOST_NODE }}"