Ansible log location in command line?

3,988 views
Skip to first unread message

Amir Luzon

unread,
Sep 10, 2015, 4:47:18 AM9/10/15
to Ansible Project
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?

Jean-Yves LENHOF

unread,
Sep 10, 2015, 8:25:30 AM9/10/15
to ansible...@googlegroups.com
Hi,

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

ANSIBLE_LOG_PATH

Regards,

JY

Amir Luzon

unread,
Sep 10, 2015, 8:33:52 AM9/10/15
to Ansible Project
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...

Jean-Yves LENHOF

unread,
Sep 10, 2015, 8:57:20 AM9/10/15
to ansible...@googlegroups.com
Le 2015-09-10 14:33, Amir Luzon a écrit :
> 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
>

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,




Reply all
Reply to author
Forward
0 new messages