---
- name: RustDesk Playbook (K8s)
  hosts: rustdesk
  gather_facts: true

# Specific tasks for this playbook
  tasks:
    - name: Set required facts
      ansible.builtin.set_fact:
        rustdesk_home: "{{ persistent_data | default('/var/lib') }}/rustdesk"
        rustdesk_user_id: 1000
        rustdesk_group_id: 1000
      tags: always

    - name: Create required rustdesk data folder
      become: true
      ansible.builtin.file:
        state: directory
        path: "{{ item }}"
        mode: "0750"
        owner: "{{ rustdesk_user_id }}"
        group: "{{ rustdesk_group_id }}"
      with_items:
        - "{{ rustdesk_home }}"
      tags:
        - tasks
        - tasks::folders
