所以在我的代码中我有一个任务
- name: cool task shell: 'touch iamnotcool.txt' when: me.cool is not defined
而且我的变种看起来像
--- me: stumped: yes
所以当我运行这个任务时,会返回以下错误
{"failed": true, "msg": "The conditional check 'me.cool' failed. The error was: error while evaluating conditional (me.cool): 'dict object' has no attribute 'cool'.
您包含的语法:
when: me.cool is not defined
是正确的。
你也可以使用not in :
when: "'cool' not in me"
问题是你的错误信息:
有条件的检查'me.cool'失败。
声称您的条件被定义为:
when: me.cool
所以,无论你使用的版本是否存在一些错误(但是你没有分享它是哪一个),并且存在已知的问题 ,或者你没有发布导致错误的确切任务。