Ansible log location in command line?

hi there,

is it at all possible to run a playbook and configure in the command like a specific location for the log file for this run?

say i have 4 playbook i want to run. i want to create separation of log files per each playbook. i know i can edit the ansible.cfg file before each run but i would prefer to avoid this.

any thoughts?

Hi,

Perhaps, you should try settings this environment variable to a different path when launching your different playbooks :

ANSIBLE_LOG_PATH

Regards,

JY

I tried the following:

  • [ansible-playbook command] -e “log_path=./blabla.log” which did not work

  • [ansible-playbook command] -e “ANSIBLE_LOG_PATH=./blabla.log” which did not work as well

i tried these with a value of “log_path” in ansible config file and without it and still the same behavior. seems like ansible only takes note of what is configured in ansible.cfg

I would assume that there has to be a way to override this value…

Reread carefully I tell about an environment variable not an ansible variable...

You should do something like :

ANSIBLE_LOG_PATH="./blabla.log" ansible-playbook myprefered-playbook.yml

or

export ANSIBLE_LOG_PATH="./blabla.log"
ansible-playbook myprefered-playbook.yml

Regards,