运行 Ansible 播放时的未定义变量
Undefined variable when running Ansible play
我是 运行 在 YAML 文件中定义的多个 ansible 播放。
在上次播放中出现以下错误:
{"failed": true, "msg": "The conditional check 'ansible_os_family == \"RedHat\"' failed. The error was: error while evaluating conditional (ansible_os_family == \"RedHat\"): 'ansible_os_family' is undefined\n
我是否需要根据收集的事实或 ansible.cfg
中的内容更改任何内容?
添加:
gather_facts: true
到你的最后一个游戏并尝试。
除了@helloV 的回答:
给自己和他人的注释,gathering =
与 gather_facts:
一起工作:
# 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
我是 运行 在 YAML 文件中定义的多个 ansible 播放。
在上次播放中出现以下错误:
{"failed": true, "msg": "The conditional check 'ansible_os_family == \"RedHat\"' failed. The error was: error while evaluating conditional (ansible_os_family == \"RedHat\"): 'ansible_os_family' is undefined\n
我是否需要根据收集的事实或 ansible.cfg
中的内容更改任何内容?
添加:
gather_facts: true
到你的最后一个游戏并尝试。
除了@helloV 的回答:
给自己和他人的注释,gathering =
与 gather_facts:
一起工作:
# 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