---
- name: M3Uproxy Playbook (K8s)
  hosts: m3uproxy
  gather_facts: true

# Specific tasks for this playbook
  tasks:
    - name: Set required facts
      ansible.builtin.set_fact:
        m3uproxy_home: "{{ persistent_data | default('/var/lib') }}/m3uproxy"
        m3uproxy_user_id: 1000
        m3uproxy_group_id: 1000
      tags: always

    - name: Create required m3uproxy data folder
      become: true
      ansible.builtin.file:
        state: directory
        path: "{{ item }}"
        mode: "0750"
        owner: "{{ m3uproxy_user_id }}"
        group: "{{ m3uproxy_group_id }}"
      with_items:
        - "{{ m3uproxy_home }}"
        - "{{ m3uproxy_home }}/cache"
        - "{{ m3uproxy_home }}/squid"
        - "{{ m3uproxy_home }}/geoip"
      tags:
        - tasks
        - tasks::folders
