Where Is The ansible.cfg Stored On macOS?

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:

  1. Open a terminal window.
  2. Change to the home directory by running the following command:
cd ~
  1. Check if there is an existing .ansible.cfg file by running the following command:
ls -a | grep .ansible.cfg

If the command returns a result, it means that the file already exists.

  1. If the file does not exist, create the file by running the following command:
touch .ansible.cfg
  1. Open the file with your favorite text editor, for example, vi:
vi .ansible.cfg
  1. Add your desired configuration options to the file.
  2. Save and exit the file by pressing CTRL+X, then Y, then ENTER.

You can now use this ansible.cfg file for all Ansible projects run by the user.

Leave a Reply

Proudly powered by WordPress | Theme: Code Blog by Crimson Themes.