---
- name: "π Resolve the LM Studio container on '{{ lmstudio_node }}'"
ansible.builtin.shell: |
{% if IS_SWARM_MODE %}
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: IS_COMPOSE_MODE 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 }}"