---
- name: "π©Ί Complete an MCP initialize handshake against the plugin endpoint"
ansible.builtin.shell:
cmd: | # nocheck: container-exec-resolver runtime-resolved CID, delegated to the hosting node
container exec -i {{ JENKINS_LOCAL_CID | quote }} \
{{ lookup('timeout', 30) | curl(5, 0) }} -f -o /dev/null \
-X POST \
-H 'Content-Type: application/json' \
-H 'Accept: application/json, text/event-stream' \
-H @- \
--data-binary {{ JENKINS_MCP_INITIALIZE_PAYLOAD | to_json | quote }} \
{{ JENKINS_MCP_URL | quote }}
stdin: "Authorization: Basic {{ (JENKINS_MCP_USERNAME ~ ':' ~ jenkins_mcp_token) | b64encode }}"
register: jenkins_mcp_endpoint_probe
changed_when: false
retries: 30
delay: 2
until: jenkins_mcp_endpoint_probe.rc == 0
delegate_to: "{{ JENKINS_HOST_NODE }}"
run_once: true
no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}"