remove_package.yaml 699 B

12345678910111213141516171819
  1. ---
  2. - name: "Removes a package using yum/dnf/apt"
  3. hosts: all
  4. gather_facts: True
  5. become: true
  6. tasks:
  7. # - name: "msg print to stdout: Debug ansible_facts"
  8. # debug:
  9. # msg:
  10. # - "{{ ansible_facts.service_mgr }}"
  11. # - "{{ ansible_facts }}"
  12. # - name: Populate systemd service_facts
  13. # service_facts:
  14. - name: Remove package using "package" module
  15. package:
  16. name: zabbix-agent
  17. state: absent
  18. #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')