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