Logging

While the default is for ansible-playbook to log to standard out, the amount of output may be greater than the buffer of the Terminal emulator being used; therefore, it may be necessary to save all the output to a file. While various shells provide some mechanism to redirect output, a more elegant solution is to direct ansible-playbook to log to a file. This is accomplished by way of either a log_path definition in the ansible.cfg file, or by setting ANSIBLE_LOG_PATH as an environment variable. The value of either should be the path to a file. If the path does not exist, Ansible will attempt to create the file. If the file does exist, Ansible will append to the file, allowing consolidation of multiple ansible-playbook execution logs.

The use of a log file is not mutually exclusive with logging to standard output. Both can happen at the same time, and the verbosity level that's provided has an effect on both, simultaneously.