---
- name: Setup Playit.gg Server
  hosts: minecraft.lab.local
  gather_facts: true

  tasks:
    - name: Create playit directory
      ansible.builtin.file:
        path: "/home/{{ admin_user }}/containers/playit"
        state: directory
        mode: "0755"

    - name: Deploy Playit Systemd Service
      become: true
      ansible.builtin.template:
        src: "./templates/playit.service.j2"
        dest: "/etc/systemd/system/playit.service"
        mode: "0644"

    - name: Strart and enable Playit service
      become: true
      ansible.builtin.systemd_service:
        name: playit.service
        state: started
        enabled: true
        daemon_reload: true
