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