On macOS, the
ansible.cfg file is not created by default. However, you can create the file manually in the root of your Ansible project directory or in the home directory of the user running Ansible.
If you create the
ansible.cfg file in the root of your Ansible project directory, it will be specific to that project. If you create the file in the home directory, it will be used as the default configuration for all Ansible projects run by that user.
To create the
ansible.cfg file in the home directory of the user running Ansible on macOS, follow these steps:
- Open a terminal window.
- Change to the home directory by running the following command:
- Check if there is an existing
.ansible.cfgfile by running the following command:
ls -a | grep .ansible.cfg
If the command returns a result, it means that the file already exists.
- If the file does not exist, create the file by running the following command:
- Open the file with your favorite text editor, for example,
- Add your desired configuration options to the file.
- Save and exit the file by pressing
You can now use this
ansible.cfg file for all Ansible projects run by the user.