--- - name: Restart MCPO service hosts: mcpo tasks: - name: Restart mcpo service become: true ansible.builtin.systemd: name: mcpo state: restarted register: restart_result - name: Wait for MCPO to be ready ansible.builtin.wait_for: port: "{{mcpo_port}}" host: localhost delay: 2 timeout: 30 state: started - name: Check if MCPO service is responding ansible.builtin.uri: url: http://localhost:{{mcpo_port}}/docs method: GET status_code: 200 register: health_check retries: 5 delay: 3 until: health_check.status == 200 - name: Report MCPO health status ansible.builtin.debug: msg: "✔ MCPO service successfully restarted and is healthy"