--- - hosts: all gather_facts: yes become: yes tasks: - name: Print the package facts ansible.builtin.debug: var: ansible_facts.packages - name: Check if a folder exists stat: path: /etc/apt register: aptfolder - name: Show if the folder exists debug: msg: "APT is on this system" when: aptfolder.stat.exists - name: Show if the folder does not exist debug: msg: "APT is on this system" when: aptfolder.stat.exists == False