--- - name: "[OpenRC] Start and enable service: grafana" service: name: grafana enabled: yes state: started when: - ansible_service_mgr == "openrc" - name: "[systemd] Start and enable service: grafana" systemd: name: grafana enabled: yes state: started when: - ansible_service_mgr == "systemd"