---
- name: Assert usage of systemd as an init system
  ansible.builtin.assert:
    that: ansible_service_mgr == 'systemd'
    msg: "This module only works with systemd"

- name: Get systemd version
  ansible.builtin.command: systemctl --version
  changed_when: false
  check_mode: false
  register: __systemd_version
  tags:
    - skip_ansible_lint

- name: Set systemd version fact
  ansible.builtin.set_fact:
    caddy_systemd_version: "{{ __systemd_version.stdout_lines[0].split(' ')[1] }}"
