FreeKB - Ansible Getting Started with Logs (log_path)
Ansible - Getting Started with Logs (log_path)

By default, ansible.cfg has log_path commented out, like this.

#log_path = /var/log/ansible.log

 

When commented out, Ansible will log events to the machines syslog (system log daemon). As an example, syslog may write Ansible events to the /var/log/messages file.

Mar 22 12:55:08 [localhost] ansible-command: Invoked with creates=None executable=None _uses_shell=True strip_empty_ends=True _raw_params=ping -c4 was2.software.eng.us removes=None argv=None warn=True chdir=None stdin_add_newline=True stdin=None

 

To configure Ansible to log events to it's own log file, one option is to uncomment the log_path line. In this example, Ansible will start to log events to /var/log/ansible.log.

log_path = /var/log/ansible.log

 

Or you could set a temporary log path using the ANSIBLE_LOG_PATH variable.

export ANSIBLE_LOG_PATH=/home/john.doe/ansible.log

 

Create the log file and update the permission so that it has the write permission for user, group and other.

touch /var/log/ansible.log
chmod 0666 /var/log/ansible.log

 

You will probably also want to configure logrotate to rotate the log files.



Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.




Please enter 7b266 in the box below so that we can be sure you are a human.




Comments

Web design by yours truely - me, myself, and I   |   jeremy.canfield@freekb.net   |