---
- name: Ensure systemd directory is present
  ansible.builtin.file:
    path: '/home/debian/.config/containers/systemd'
    state: 'directory'
    mode: '0755'
    owner: 'debian'
    group: 'debian'

- name: Ensure data directory permissions are correct
  ansible.builtin.file:
    path: '{{ greptimedb_data_dir }}'
    state: directory
    owner: 'debian'
    group: 'debian'
  become: true

- name: Ensure Quadlet files are present
  ansible.builtin.template:
    src: "greptimedb.container.j2"
    dest: "/home/debian/.config/containers/systemd/greptimedb.container"
    mode: '0755'
    owner: 'debian'
    group: 'debian'
  notify: 'restart greptimedb'

# - name: Ensure stack is deployed
#   ansible.builtin.shell:
#     chdir: '/etc/miniflux'
#     cmd: 'docker compose up -d --remove-orphans'
#   when: 'res.changed'

# - name: Ensure backup script is present
#   ansible.builtin.copy:
#     src: 'miniflux.backup.sh'
#     dest: '/etc/backups/miniflux.backup.sh'
#     owner: 'root'
#     group: 'root'
#     mode: '0644'
