53 lines
1.7 KiB
YAML
53 lines
1.7 KiB
YAML
---
|
|
- name: Validate Caddy configuration
|
|
ansible.builtin.command: caddy validate --config "{{ acp_opencode_caddyfile_path }}"
|
|
changed_when: false
|
|
when: acp_opencode_manage_caddy | bool
|
|
|
|
- name: Check OpenCode ACP listener
|
|
ansible.builtin.shell: |
|
|
if command -v ss >/dev/null 2>&1; then
|
|
ss -ltnp
|
|
else
|
|
lsof -nP -iTCP -sTCP:LISTEN 2>/dev/null || true
|
|
fi
|
|
args:
|
|
executable: /bin/bash
|
|
register: acp_opencode_ss
|
|
changed_when: false
|
|
failed_when: false
|
|
|
|
- name: Validate OpenCode local ACP endpoint
|
|
ansible.builtin.uri:
|
|
url: "http://{{ acp_opencode_listen_host }}:{{ acp_opencode_listen_port }}/acp/rpc"
|
|
method: POST
|
|
body_format: json
|
|
body:
|
|
jsonrpc: "2.0"
|
|
id: 1
|
|
method: acp.capabilities
|
|
params: {}
|
|
return_content: true
|
|
status_code: 200
|
|
register: acp_opencode_adapter_http
|
|
retries: 30
|
|
delay: 2
|
|
until: acp_opencode_adapter_http.status == 200
|
|
|
|
- name: Show OpenCode ACP status
|
|
ansible.builtin.command: systemctl status "{{ acp_opencode_service_name }}" --no-pager
|
|
register: acp_opencode_status
|
|
changed_when: false
|
|
failed_when: false
|
|
|
|
- name: Show OpenCode ACP validation summary
|
|
ansible.builtin.debug:
|
|
msg:
|
|
- "OpenCode public base URL: {{ acp_opencode_public_base_url }}"
|
|
- "Preferred WebSocket endpoint: {{ acp_opencode_public_base_url }}/acp"
|
|
- "Compatibility HTTP RPC endpoint: {{ acp_opencode_public_base_url }}/acp/rpc"
|
|
- "OpenCode ACP adapter listener: {{ acp_opencode_listen_host }}:{{ acp_opencode_listen_port }}"
|
|
- "Service: {{ acp_opencode_status.stdout | default('N/A') }}"
|
|
- "Socket: {{ acp_opencode_ss.stdout | default('N/A') }}"
|
|
- "Adapter capabilities HTTP: {{ acp_opencode_adapter_http.content | default('N/A') }}"
|