析取短语在 ansible 条件下不起作用

disjunctional phrase not working in ansible conditional

我想写这样的东西:

- name: get gui2 git contents
  git: repo={{ gui2_repository }} dest=/var/www/gui2 version={{ gui2_gitversion }}
  when: update_all or update_gui2

但是,即使 update_allupdate_gui2 都为 false,它仍然运行上述任务。

如果我只用

- name: get gui2 git contents
  git: repo={{ gui2_repository }} dest=/var/www/gui2 version={{ gui2_gitversion }}
  when: update_all

(或上面 when 中的 update_gui2),它会按原样跳过任务。

知道我应该如何在 ansible conditinal 中编写析取逻辑短语吗?

来自评论的回答:

Try with boolean conversion when: update_all | bool or update_gui2 | bool

这是因为 ansible-jinja 模板引擎对整个表达式和部分表达式的工作方式有点不同。