--- - name: "🔍 Resolve the LM Studio container on '{{ lmstudio_node }}'" ansible.builtin.shell: | {% if DEPLOYMENT_MODE == 'swarm' %} container ps \ --filter "label=com.docker.swarm.service.name={{ lmstudio_service_name }}" \ --filter status=running \ --format '{{ "{{.ID}}" }}' | head -1 {% else %} echo {{ LMSTUDIO_CONTAINER | quote }} {% endif %} register: lmstudio_node_cid changed_when: false retries: 30 delay: 2 until: DEPLOYMENT_MODE == 'compose' or (lmstudio_node_cid.stdout | trim) | length > 0 delegate_to: "{{ lmstudio_node }}" - name: "🔧 Target '{{ lmstudio_node }}' for the next LM Studio step" ansible.builtin.set_fact: LMSTUDIO_HOST_NODE: "{{ lmstudio_node }}" LMSTUDIO_LOCAL_CID: "{{ lmstudio_node_cid.stdout | trim }}"