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