refresh_model_grants.ymlΒΆ

---
- name: "πŸ” Check whether {{ application_id }} already runs"
  ansible.builtin.command:
    argv: >-
      {{ ['container', 'service', 'ls', '-q', '--filter', 'name=' ~ lookup('container_service', application_id, entity_name)]
         if IS_SWARM_MODE
         else ['container', 'ps', '-q', '--filter', 'status=running', '--filter', 'name=^' ~ OPENWEBUI_CONTAINER ~ '$'] }}
  register: openwebui_running
  changed_when: false
  delegate_to: "{{ STACK_HOST }}"
  run_once: true

- name: "πŸ” Re-grant the gateway models in the running {{ application_id }}"
  ansible.builtin.include_tasks: "{{ lookup('path_absolute', 'roles/web-app-openwebui/tasks/utils/agent_models.yml') }}"
  when: openwebui_running.stdout | trim | length > 0