gather-facts 收集环境变量

noteId: WEB4beb3123f8d381398566ccbc7ccede04 · 原始路径:/ALL/Ansible 自动化管理/Ansible 配置合集/常用内置模块 一些 Ansible 中可以用到的语法/gather-facts 收集环境变量.note

·在 Ansible 剧本中可以使用 gather_facts: true 进行收集环境变量:

例子:如果剧本定义的 gather_facts: false那么就不会有关于系统当前时间的变量:{{ ansible_date_time }}如果剧本定义了 gather_facts: true那么就会有时间变量:{{ ansible_date_time }}