Where do I find the latest ansible error log

I used an ansible script to bring a server configuration up. I was running the script from inside the server and doing everything at the localhost inventory.

Now the ssh connection I had to the server closed and I cannot find the log file. Where is the standard log path for this? Under /var/log there is no ansible file.

I am running the script again, and I expect the error to come again, but this is not a great solution since the script takes a few hours to run to the error point.


Ansible doesn't create it's own logs by default - you have to tell it to do so, using an ansible.cfg file. Ansible does do some logging to syslog by default:

Note that ansible will, without this setting, record module arguments called to the syslog of managed machines.

So, that'll log module args to the syslog of the machines you're managing.

To switch on full logging, on your control machine, you can create an ansible.cfg file that looks like this:

[defaults]
log_path = ./ansible.log

Then save it somewhere ansible will look for it. Ansible checks these locations for ansible.cfg files, in this order:

  • ANSIBLE_CONFIG (an environment variable)
  • ansible.cfg (in the current directory)
  • .ansible.cfg (in the home directory)
  • /etc/ansible/ansible.cfg

An alternative option is to set the ANSIBLE_LOG_PATH environment variable, to the path you want to log to - it's equivalent to setting the log_path option in the ansible.cfg file.

See here for more information: http://docs.ansible.com/intro_configuration.html


Have a rummage around in your system's syslog file location. That's where it usually ends up for me (Ubuntu 12.04).

Failing that, you might want to run ansible-playbook -vvvv $args to turn on some debug logging, then tee it to a file.