running ansible on MacOS

January 19, 2021

As I’m used to run linux I want to recap how to get along with ansible on MacOS.

note: there’s no platform dependency here. This should work both on m1/silicon as it will on x86-based computers.

Get ansible

Install ansible by using Homebrew:

brew install ansible

Configure hosts lists

As ansible is installed by brew I don’t want to mix configurations of my system within /etc.

I want to manage my inventory hosts within my home directory as this device isn’t shared anyways.

Proceed by creating a dot-directory called .ansible within your directory and create a hosts-file like this:



The documentation notes one can create a new file called .ansible.cfg within your home directory and edit the inventory location there.


inventory = .ansible/hosts

Finally test your configuration by running

ansible -m ping all

Don’t put the inventory value within caps. Don’t use an absolute path. Otherwise ansible fails to resolve the configuration file location like this:

Changing any config value takes immediate effect – there’s no need to create a new shell instance.

Leave a comment