For debugging purposes, we would like to configure Ansible to write logs to a di . . .

vaibhav patil:
For debugging purposes, we would like to configure Ansible to write logs to a different path than default. Configure Ansible to write logs to /var/log/ansible/ansible.log.

i have changed in /etc/ansible/ansible.cfg file
uncommented and changed path
log_path = /var/log/ansible/ansible.log

but still not done anyone plz help

Al West:
Run ansible --version and confirm that is the path being used for logs. Also check the path exists and has the right permissions.

vaibhav patil:
ok

vaibhav patil:
nsible 2.9.27
config file = /etc/ansible/ansible.cfg
configured module search path = [u’/home/thor/.ansible/plugins/modules’, u’/usr/share/ansible/plugins/modules’]
ansible python module location = /usr/lib/python2.7/site-packages/ansible
executable location = /bin/ansible
python version = 2.7.5 (default, Jun 20 2019, 20:27:34) [GCC 4.8.5 20150623 (Red Hat 4.8.5-36)]

vaibhav patil:
ansible 2.9.27

vaibhav patil:
path was not there path created

vaibhav patil:
assign permission 777

Al West:
Also you are use an older version of ansible. I’d upgrade to one that is using Python3 - probably best done through pip.

vaibhav patil:
still same

Al West:
Are you sure you have:

log_path = /var/log/ansible/ansible.log

Under [defaults] in /etc/ansible/ansible.cfg and that you have set permissions to 777 on /var/log/ansible ?

Garvit Jain:
Might be a permission or folder/file ownership issue. It might be because the file you created comes under different owner or root and is not accessible by the ansible while running
Try doing ls -la /var/log/ansible/

vaibhav patil:
Thank you will check