--- - name: "Removes a package using yum/dnf/apt" hosts: all gather_facts: True become: true tasks: # - name: "msg print to stdout: Debug ansible_facts" # debug: # msg: # - "{{ ansible_facts.service_mgr }}" # - "{{ ansible_facts }}" # - name: Populate systemd service_facts # service_facts: - name: Remove package using "package" module package: name: zabbix-agent state: absent #when: ansible_facts['os_family'] != "RedHat" and ansible_facts['distribution_major_version'] != 7 and (ansible_facts['distribution'] == 'RedHat') and (ansible_facts['distribution_major_version'] == '9')