Ansible is used to automate deployment to servers. You have built, tested, packaged your app, then you need to deploy it somewhere. Here, Ansible comes in. It’s gonna do the job for you in an automated way.
If you are asking if there are any other ways to achieve this. Of course, there are. You can also just write a shell script that can ssh to the machine and run the containers that you want. However, the power of Ansible is its ability to automate the deployment in many servers at the same time. I mean If you want to deploy your app in many environments/servers at the same time (dev, staging..) you can achieve this. Moreover, with Ansible you can interact with other technologies/tools, for example, you can describe your docker-compose and run it or interact with Kubernetes clusters and more.
I hope this helps a little bit :)