With Ansible you can automate more fine grained, if we had Terraform to setup AWS EC2 for example, which is a server in the cloud.
Then with Ansible you can install software on that server, configure the firewall ports, install anything related to your software project.
Ansible supports many different types of Operating Systems and many different types of automation from setting up SSH keys, installing Services that auto-run on system boot, to deploying code using GitHub.
It’s a very versatile tool that can codify a lot of the environment setup so you can repeat it again and again without worry it will be different each time and you may be forgetting something.