As well as configuring servers, you can use Ansible to configure your own local machine and development environment.
The change that you need to make is within the hosts.ini file:
Instead of the server’s IP address or hostname, use the localhost IP address and set ansible_connection to local to tell Ansible to run locally instead of using an SSH connection.
Another way to do this is to set hosts: 127.0.0.1 and connection: true in your playbook.
Once this is done, you can run tasks, roles, and collections to automate tasks such as installing software, adding your SSH keys, configuring your project directories, and anything else that you need to do.