Ansible 2.4: configure inventory file path on macOS

After upgrading ansible to 2.4 (from homebrew), my previous inventory file (/usr/local/etc/ansible/hosts) was no longer found:

[WARNING]: Unable to parse /etc/ansible/hosts as an inventory source

My solution was to configure the path to the inventory file in ~/.ansible.cfg:

[defaults]
inventory = /usr/local/etc/ansible/hosts

Note that before ansible 2.4, the setting name for the inventory file used to be hostfile, which is now deprecated and you should use inventory instead.