mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-06 19:01:54 +00:00
Handlers are play-global and deduplicated by name, the last registration wins, and a notification resolves in the handler's own context rather than the notifier's. Every app normally re-registers the compose handlers in its own context through the backend stack right before it notifies, which is what keeps that resolution correct. Reconciling entered each client through tasks_from, so the client's core never ran and no re-registration happened. The last registration in the play then came from a role imported without vars, which lets the handler-role literal through, and the guard caught a flush bound to a role that owns no instance directory. Had the last registration belonged to a real app the guard would have passed and the restart would have gone to the wrong one, unnoticed. Rebinding through an include gives the client id as an include parameter, which outranks the role vars the handler import sets. Flushing inside the loop keeps a client that does not flush on its own from having its notification collapsed into the following client's context at the trailing flush. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
33 lines
1.2 KiB
YAML
33 lines
1.2 KiB
YAML
---
|
|
- name: "🔒 Stop excusing a provider whose credential never resolved"
|
|
ansible.builtin.set_fact:
|
|
MCP_RECONCILE_STRICT: true
|
|
|
|
- name: "🔍 Find which MCP clients this deployment actually carries"
|
|
ansible.builtin.stat:
|
|
path: "{{ lookup('container', mcp_client.id, 'directories.instance') }}"
|
|
register: mcp_client_instances
|
|
loop: "{{ lookup('roles_with_service', 'mcp', topic='mcp', direction='client') }}"
|
|
loop_control:
|
|
loop_var: mcp_client
|
|
label: "{{ mcp_client.id }}"
|
|
changed_when: false
|
|
delegate_to: "{{ STACK_HOST }}"
|
|
|
|
- name: "🔌 Reconcile every MCP client against the complete provider set"
|
|
ansible.builtin.include_tasks: "utils/reconcile_one.yml"
|
|
vars:
|
|
application_id: "{{ mcp_client.id }}"
|
|
domain: "{{ lookup('domain', mcp_client.id) }}"
|
|
loop: "{{ mcp_client_instances.results | selectattr('stat.exists') | map(attribute='mcp_client') | list }}"
|
|
loop_control:
|
|
loop_var: mcp_client
|
|
label: "{{ mcp_client.id }}"
|
|
|
|
- name: "🚿 Flush what the clients notified while they were still bound"
|
|
ansible.builtin.meta: flush_handlers
|
|
|
|
- name: "🔓 Stop being strict once the reconciliation is over"
|
|
ansible.builtin.set_fact:
|
|
MCP_RECONCILE_STRICT: false
|