- name: Setup open-webui
  hosts: openwebui

  tasks:
    - name: Set required facts
      ansible.builtin.set_fact:
        open_webui_home: "{{ persistent_data | default('/var/lib') }}/open_webui"
        open_webui_user_id: 0
        open_webui_group_id: 0
      tags: always

    - name: Create required open_webui data folder
      become: true
      ansible.builtin.file:
        state: directory
        path: "{{ item }}"
        mode: "0750"
        owner: "{{ open_webui_user_id }}"
        group: "{{ open_webui_group_id }}"
      with_items:
        - "{{ open_webui_home }}"
      tags:
        - tasks
        - tasks::folders
