mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-06 10:59:59 +00:00
container exec is node-local: sys-svc-container/files/python/container.py dispatches docker exec with no swarm routing. These roles passed *_CONTAINER_ADDRESS, which names the service cluster-wide, and ran from the stack host, so a call landed on the manager and answered "No such container" whenever the task sat on a worker. Each branch now resolves the hosting node and its node-local id once through sys-svc-compose/tasks/utils/swarm/resolve_host_cid.yml, the way web-app-baserow already does, and every exec uses *_LOCAL_CID with delegate_to on *_HOST_NODE. Compose is untouched: resolve_host_cid sets *_HOST_NODE to inventory_hostname there, so the delegation is to self and resolve_compose_cid passes the old address through. penpot resolves only when native login is enabled, because the resolver waits up to 600x2s for convergence and both of its exec tasks are already gated on that flag. The *_LOCAL_CID names come from a runtime set_fact, which the resolver lint cannot approve, so each scanned call site carries the nocheck the migrated mastodon sites already use. Measured with the lint parser itself: 19 exec lines carry a target, 19 would be flagged, 19 are suppressed. No nocheck reaches a rendered command or a task name, and the one comment that does land inside a bash body passes bash -n. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
100 lines
4.1 KiB
YAML
100 lines
4.1 KiB
YAML
---
|
|
- name: "⏳ Wait for Joomla files to exist"
|
|
shell: > # nocheck: container-exec-resolver runtime-resolved CID, delegated to the hosting node
|
|
container exec {{ JOOMLA_LOCAL_CID | quote }} test -f /var/www/html/plugins/actionlog/joomla/joomla.xml
|
|
register: joomla_files
|
|
changed_when: false
|
|
retries: 60
|
|
delay: 2
|
|
until: joomla_files.rc == 0
|
|
delegate_to: "{{ JOOMLA_HOST_NODE }}"
|
|
|
|
- name: "⏳ Wait for the image entrypoint to finish its own install"
|
|
shell: > # nocheck: container-exec-resolver runtime-resolved CID, delegated to the hosting node
|
|
container exec {{ JOOMLA_LOCAL_CID | quote }}
|
|
sh -c 'test -e {{ JOOMLA_INIT_READY_FILE }} || test -e {{ JOOMLA_CONFIG_FILE }}'
|
|
register: joomla_entrypoint_done
|
|
changed_when: false
|
|
failed_when: false
|
|
retries: 60
|
|
delay: 5
|
|
until: joomla_entrypoint_done.rc == 0
|
|
delegate_to: "{{ JOOMLA_HOST_NODE }}"
|
|
|
|
- name: "🔎 Check for CLI installer"
|
|
shell: > # nocheck: container-exec-resolver runtime-resolved CID, delegated to the hosting node
|
|
container exec {{ JOOMLA_LOCAL_CID | quote }} test -f {{ JOOMLA_INSTALLER_CLI_FILE }}
|
|
register: has_installer
|
|
changed_when: false
|
|
failed_when: false
|
|
delegate_to: "{{ JOOMLA_HOST_NODE }}"
|
|
|
|
- name: "🔎 Check if Joomla is already installed"
|
|
shell: > # nocheck: container-exec-resolver runtime-resolved CID, delegated to the hosting node
|
|
container exec {{ JOOMLA_LOCAL_CID | quote }} test -f {{ JOOMLA_CONFIG_FILE }}
|
|
register: joomla_installed
|
|
changed_when: false
|
|
failed_when: false
|
|
delegate_to: "{{ JOOMLA_HOST_NODE }}"
|
|
|
|
- name: "📦 Joomla CLI install (rm stub + install in one retry loop for image-init race)"
|
|
ansible.builtin.command:
|
|
argv:
|
|
- bash
|
|
- -lc
|
|
- |
|
|
set -o pipefail
|
|
container exec {{ JOOMLA_LOCAL_CID | quote }} rm -f "{{ JOOMLA_CONFIG_FILE }}" # nocheck: container-exec-resolver runtime-resolved CID, delegated to the hosting node
|
|
exec container exec --user "{{ JOOMLA_WEB_USER }}" {{ JOOMLA_LOCAL_CID | quote }} \
|
|
php "{{ JOOMLA_INSTALLER_CLI_FILE }}" install \
|
|
"--db-type={{ JOOMLA_DB_CONNECTOR }}" \
|
|
"--db-host={{ lookup('database', application_id, 'host') }}" \
|
|
"--db-user={{ lookup('database', application_id, 'username') }}" \
|
|
"--db-pass=${J_DB_PASSWORD}" \
|
|
"--db-name={{ lookup('database', application_id, 'name') }}" \
|
|
"--admin-user={{ JOOMLA_USER }}" \
|
|
"--admin-username={{ JOOMLA_USER_NAME }}" \
|
|
"--admin-password=${J_ADMIN_PASSWORD}" \
|
|
"--admin-email={{ JOOMLA_USER_EMAIL }}" \
|
|
--no-interaction \
|
|
"--site-name={{ JOOMLA_SITE_NAME }}"
|
|
environment:
|
|
J_DB_PASSWORD: "{{ lookup('database', application_id, 'password') }}"
|
|
J_ADMIN_PASSWORD: "{{ JOOMLA_USER_PASSWORD }}"
|
|
register: j_install
|
|
retries: 5
|
|
delay: 5
|
|
vars:
|
|
# Exception: retrying is destructive; the retry loop `rm -f`s the freshly written configuration.php then fails because the installer self-deleted its entry file.
|
|
_joomla_install_soft_success: >-
|
|
{{
|
|
j_install.rc == 0
|
|
or (j_install.stdout | default('') is search('Unable to delete installation folder'))
|
|
or (j_install.stderr | default('') is search('deleteInstallationFolder'))
|
|
}}
|
|
_joomla_install_git_tree_refusal: >-
|
|
{{ j_install.stdout | default('') is search('trying to run Joomla! from our git repository') }}
|
|
until: _joomla_install_soft_success | bool
|
|
changed_when: _joomla_install_soft_success | bool
|
|
failed_when: >-
|
|
(
|
|
j_install.rc is defined
|
|
and j_install.rc != 0
|
|
and not (_joomla_install_soft_success | bool)
|
|
)
|
|
or (_joomla_install_git_tree_refusal | bool)
|
|
no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}"
|
|
when:
|
|
- joomla_installed.rc != 0
|
|
- has_installer.rc == 0
|
|
delegate_to: "{{ JOOMLA_HOST_NODE }}"
|
|
|
|
- name: "💪 Force-remove installation folder (root)"
|
|
shell: > # nocheck: container-exec-resolver runtime-resolved CID, delegated to the hosting node
|
|
container exec {{ JOOMLA_LOCAL_CID | quote }} rm -rf /var/www/html/installation
|
|
changed_when: false
|
|
when:
|
|
- joomla_installed.rc != 0
|
|
- has_installer.rc == 0
|
|
delegate_to: "{{ JOOMLA_HOST_NODE }}"
|