- name: Ensure snippets directory exists
  ansible.builtin.file:
    path: /var/lib/vz/snippets
    state: directory
    mode: "0755"

- name: Upload cloud-init snippet
  ansible.builtin.copy:
    src: cloud-init-user-data.yaml
    dest: /var/lib/vz/snippets/cloud-init-user-data.yaml
    mode: "0644"

- name: Verify cloud-init snippet is recognized
  ansible.builtin.shell: qm cloudinit dump 9000 user
  register: cloudinit_check
  ignore_errors: true
