Files
computer-playbook/roles/svc-prx-openresty/handlers/reload.yml
kevinveenbirkenbachandClaude Opus 5 a46348b6cf refactor(handlers): bind notify to a listen topic, not to a name
A handler name was doing two jobs at once: the line an operator reads in the
play output, and the identifier a `notify:` binds to. The two pull in opposite
directions -- the log wants "restart the SSH service, with diagnostics", the
binding wants a token that survives quoting, YAML flow style and a shell
round-trip -- and a name that changes for readability silently changes which
handler runs.

Every handler that a notify reached by name now carries a `listen:` with that
exact wording, so the binding is explicit before anything is renamed. The
topics themselves become identifiers: `compose up` reads `compose-up`,
`Restart NFS ganesha` reads `restart-nfs-ganesha`, 22 of them across both
sides of every notify. Where the topic is assembled at runtime, both branches
moved together: the conditional in sys-service carries two literals, and the
LDAP renderer interpolates `import-{{ folder }}-ldif-files`, which is what
makes those handlers reachable at all.

Freed from the binding, the names take the emoji prefix every other task line
already has.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-16 03:38:42 +02:00

33 lines
1.6 KiB
YAML

---
# Vhosts, redirect configs and body_filter Lua all land under
# directories.configuration.base, which sits inside the conf.d DIRECTORY bind.
# A directory keeps its inode across an atomic file write, so the running
# container already sees the new file and SIGHUP is enough -- unlike
# nginx.conf, which is bound as a FILE and whose inode the task pins at create
# time (see restart.yml).
- name: ✅ Validate OpenResty configuration before reloading
ansible.builtin.shell: >
container exec {{ lookup('container_address', 'svc-prx-openresty', 'openresty') }} openresty -t -q
register: openresty_test_reload
changed_when: false
retries: 10
delay: 3
until: openresty_test_reload.rc == 0
failed_when: >
openresty_test_reload.rc != 0 and
('is not running' not in ((openresty_test_reload.stderr | default('')) | lower)) and
('no such container' not in ((openresty_test_reload.stderr | default('')) | lower)) and
('is restarting' not in ((openresty_test_reload.stderr | default('')) | lower))
- name: ♻️ Reload OpenResty
ansible.builtin.shell: >
container exec {{ lookup('container_address', 'svc-prx-openresty', 'openresty') }} openresty -s reload
register: openresty_reload
changed_when: openresty_reload.rc == 0
failed_when: >
openresty_reload.rc != 0 and
('is not running' not in ((openresty_reload.stderr | default('')) | lower)) and
('no such container' not in ((openresty_reload.stderr | default('')) | lower)) and
('is restarting' not in ((openresty_reload.stderr | default('')) | lower))
when: openresty_test_reload.rc == 0