--- - name: "[OpenRC] Disable and stop service: nginx" service: name: nginx enabled: no state: stopped when: - ansible_service_mgr == "openrc" - name: "[systemd] Disable and stop service: nginx" systemd: name: nginx enabled: no state: stopped when: - ansible_service_mgr == "systemd" - name: "[Alpine] Remove package: nginx" apk: name: nginx state: absent when: - ansible_distribution == "Alpine" - name: "[Archlinux] Remove package: nginx" pacman: name: nginx state: absent when: - ansible_distribution == "Archlinux" - name: "Remove directory: /etc/nginx" file: path: /etc/nginx state: absent - name: "[nftables] Delete rule for: nginx" file: path: /etc/nftables.d/nginx.nft state: absent notify: "Restart nftables"