--- - name: "[OpenRC] Enable and start service: dnsmasq" service: name: dnsmasq enabled: yes state: started when: - ansible_service_mgr == "openrc" - name: "[systemd] Enable and start service: dnsmasq" systemd: name: dnsmasq enabled: yes state: started when: - ansible_service_mgr == "systemd"