--- - hosts: all become: true tasks: - name: Update repository index ansible.builtin.package: update_cache: yes #### Ubuntu/Debian Section #### - name: Install apache2 package package: name: apache2 state: absent when: ansible_os_family == "Debian" - name: Install support for php package: name: libapache2-mod-php state: absent when: ansible_os_family == "Debian" #### EL Section #### - name: Install apache2 package package: name: httpd state: absent when: ansible_os_family == "RedHat" - name: Install support for php package: name: php state: absent when: ansible_os_family == "RedHat"