---
- 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'
