从“ansible.cfg”或清单文件中关闭“gather_facts”

从“ansible.cfg”或清单文件中关闭“gather_facts”

gather_facts除了在游戏级别之外还有其他方法可以关闭吗?如果我想永久禁用它,有没有办法在ansible.cfg或清单文件中做到这一点?

答案1

ansible.cfg

# plays will gather facts by default, which contain information about
# the remote system.
#
# smart - gather by default, but don't regather if already gathered
# implicit - gather by default, turn off with gather_facts: False
# explicit - do not gather by default, must say gather_facts: True
gathering = explicit

答案2

gather_facts除了在游戏级别之外还有其他方法可以关闭吗?如果我想永久禁用它,有没有办法在ansible.cfg...

是的当然。根据 Ansible 文档Ansible 配置设置有关配置文件DEFAULT_GATHERINGgathering = explicit

默认implicit

选择

  • implicitgather_facts: False除非设置,否则缓存插件将被忽略,并且每次播放都会收集事实。
  • explicit除非剧中直接要求,否则不会收集事实。

相关内容