Files
computer-playbook/roles/sys-svc-rdbms/tasks/dedicated_postgres.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

36 lines
1.4 KiB
YAML

---
- block:
- name: "✅ Ensure initdb.d dir exists: {{ _database_initdb_dir }}"
ansible.builtin.file:
path: "{{ _database_initdb_dir }}"
state: directory
mode: "0755"
- name: "📄 For '{{ application_id }}/{{ _database_consumer_id }}': Render extensions.sql"
stack_host_template:
src: "initdb.d/extensions.sql.j2"
dest: "{{ _database_initdb_dir }}extensions.sql"
mode: "0644"
notify: compose-up
when: (_database_extensions | length) > 0
- block:
- name: "✅ Ensure postgres build dir exists: {{ _database_build_dir }}"
ansible.builtin.file:
path: "{{ _database_build_dir }}"
state: directory
mode: "0755"
- name: "📄 For '{{ application_id }}/{{ _database_consumer_id }}': Render libs Dockerfile"
stack_host_template:
src: "{{ lookup('path_absolute', 'roles/svc-db-postgres/templates/Dockerfile.j2') }}"
dest: "{{ _database_build_dir }}Dockerfile"
mode: "0644"
vars:
POSTGRES_IMAGE: "{{ lookup('database', _database_consumer_id, 'image') }}"
POSTGRES_VERSION: "{{ lookup('database', _database_consumer_id, 'version') }}"
POSTGRES_VERSION_MAJOR: "{{ lookup('database', _database_consumer_id, 'version') | regex_replace('^([0-9]+).*', '\\1') }}"
POSTGRES_LIBRARIES: "{{ _database_libraries }}"
notify:
- compose-build
- compose-up
when: (_database_libraries | length) > 0