Configuration 语句ansible时循环中的变量

Configuration 语句ansible时循环中的变量,configuration,ansible,devops,configurationmanager,ansible-template,Configuration,Ansible,Devops,Configurationmanager,Ansible Template,我试图在when语句中使用一个变量,ansible会弹出这样的警告 [WARNING]: when statements should not include jinja2 templating delimiters such as {{ }} or {% %}. Found: {{ item.name}}.changed 我首先使用循环: - include_tasks: anaconda_env.yml with_items: "{{anaconda_templates}}" 在a

我试图在when语句中使用一个变量,ansible会弹出这样的警告

 [WARNING]: when statements should not include jinja2 templating delimiters such as {{ }} or {% %}. Found: {{ item.name}}.changed
我首先使用循环:

- include_tasks: anaconda_env.yml
  with_items: "{{anaconda_templates}}"
在anaconda_env file.yml中,我有一个:

- name: anaconda.templates
  template:
    owner: "{{item.owner|default(common_owner)}}"
    group: "{{item.group|default(common_group)}}"
    mode: "{{item.mode|default(common_mode)}}"
    src: "{{item.template}}"
    dest: "{{item.dest}}"
  register: "{{item.name}}"

- name: anaconda.handler
  command: echo '1' 
  notify: "{{item.name}}"
  when: "{{ item.name}}.changed"
在另一种情况下,我尝试了“{item.name}}.rc==1”,我也遇到了同样的问题。你知道我该如何避免这条消息吗

我在这里发现了问题,但没有解决办法


我最初的答案不起作用,但我相信下面的答案会起作用(或者至少对我有限的模拟数据起作用):

- set_fact:
    current_template: "{{item}}"
- name: anaconda.handler
  command: echo '1' 
  notify: "{{item.name}}"
  when: current_template.changed is defined