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