我想在Ansible剧本中有条件地定义一个变量,如下所示:如果条件不能解析为true,我希望变量保持未定义状态。如果我尝试执行代码,Ansible会给出以下错误:
fatal: [foo.local] => {'msg': 'AnsibleUndefinedVariable: One or more undefined',
在my Ansible roles中,某些角色从全局变量派生特定的配置设置全局变量可能未定义。- debug: msg="bar is defined"
when: 'bar is defined' 一切都按预期运行,但最后一条语句: Ansible引发了一个异常,因为foo是未定义的(是的,它是未定义的)。appears to