I run my ansible-playbook
with the following command in my localhost:
ansible-playbook -i "localhost," -c local GitClone.yaml
However, I also have a GitClone.cfg
file which has:
[defaults]
transport = ssh
[ssh_connection]
ssh_args = -o ForwardAgent=yes
The GitClone.cfg
file is in the same directory as the GitClone.yaml
file.
How do I include this file in the command?
The command mentioned above is not picking up the .cfg file.
The proper name for the Ansible configuration file is ansible.cfg
.
It is a fixed name and Ansible does not look for any other .cfg
file unless you explicitly provided the path in ANSIBLE_CONFIG
variable.
Have a look at the documentation. Ansible checks the files in the following order:
ANSIBLE_CONFIG
(an environment variable)ansible.cfg
(in the current directory).ansible.cfg
(in the home directory)/etc/ansible/ansible.cfg
The above documentation link got expired
Here is the sample ansible.cfg file from ansible git repo https://github.com/ansible/ansible/blob/stable-2.9/examples/ansible.cfg
Documentation link: https://docs.ansible.com/ansible/latest/reference_appendices/config.html
for checking which configuration values are active in a current directory. run the below commands will provide you the infromation
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With