问题描述
我的Ansible配置文件ansible.cfg包含:log_path=ansible.log
因此,启用了日志记录。但是我希望上述配置对于特定的剧本被覆盖,即仅对一个剧本禁用日志记录。这种可能性是可能的吗?
ansible-playbook -i inventory/hosts.ini <logging=None>
是否可以覆盖日志记录配置并在剧本级别或使用命令行将其禁用?
根据Ansible documentation,
环境变量ANSIBLE_LOG_PATH
可以覆盖ansible.cfg文件中的log_path,但这似乎无助于暂时禁用日志记录。
解决方法
空DEFAULT_LOG_PATH禁用日志记录。 Environment variables have a higher precedence than entries in ansible.cfg。试试
ANSIBLE_LOG_PATH=" " ansible-playbook playbook.yml