- name: ensure script is run as root ansible.builtin.assert: that: - ansible_effective_user_id == 0 fail_msg: "this playbook must be run as root" - name: check if system is debian-based ansible.builtin.command: dpkg -l register: dpkg_check changed_when: false failed_when: false - name: fail if not debian-based ansible.builtin.fail: msg: "distribution not Debian-based" when: dpkg_check.rc != 0