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