Drupal 9 is now end of life and unsupported. If you're stuck on Drupal 7, 8 or 9, get unstuck with a Drupal upgrade roadmap and upgrade to Drupal 10.

Using Ansible for local environment configuration

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: ansible_connection=local

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: 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.

For an example of this, you can see my dotfiles repository on GitHub.

Want to learn more about how I use Ansible? Register for my upcoming free email course.

    Was this useful? Sign up here and get more like this delivered straight to your inbox every day.