Is there a way to set the Ansible log file name dynamically to the playbook name that is running?
I've tried to use ansible.cfg
for that, but that doesn't worked.
From your few description I guess you are interested in Logging Ansible output to
"save Ansible output in a single log on the Control Node, set the
log_path
configuration file setting"
and by using the playbook file name, right?
Please take note that those configuration parameters were not mentioned to be dynamic. So except from setting environment variables
# Run
export NAME='test'; ANSIBLE_LOG_PATH=~/test/${NAME}.log ansible-playbook ${NAME}.yml
there seems to be no other options.
# View log
~/test$ cat ${NAME}.log
Or maybe renaming the generated log file afterwards to the playbook name.
Similar Q&A