title: ansible: dict object' has no attribute with when defined
body: <p>I have this property file:</p>
  <pre><code>addresses:
    AAA:
      type: &quot;anycast&quot;
      queues:
        - queue_name: &quot;AAA.bbb&quot;
          queue_filter: &quot;'%aaaa%'&quot;
    BBB:
      type: &quot;multicast&quot;
      queues:
        - queue_name:  &quot;BBB.ccc&quot;
          queue_filter: &quot;'%cccc%'&quot;
        - queue_name: &quot;RRR.wwww&quot;
          queue_filter: &quot;'%wwww%'&quot;
          max_redelivery_delay: &quot;30000&quot;
          max_delivery_attempts: &quot;1500&quot;
          expiry_delay: &quot;172800000&quot;
  </code></pre>
  <p>This is my ansible code:</p>
  <pre><code>  - name: configure - clustering - addresses - settings
      xml:
        path: &quot;/tmp/broker.xml&quot;
        xpath: &quot;/conf:configuration/core:core/core:address-settings/core:address-setting[@match='{{ item.0.key }}::{{ item.1.queue_name }}']&quot;
        add_children:
          - max-redelivery-delay: &quot;{{ item.1.max_redelivery_delay }}&quot;
        namespaces:
          conf: urn:activemq
          core: urn:activemq:core
        pretty_print: yes
        when: item.1.max_redelivery_delay is defined
      with_subelements:
        - &quot;{{ addresses|dict2items }}&quot;
        - value.queues
      delegate_to: localhost
  </code></pre>
  <p>Now I get this error:</p>
  <pre><code>TASK [configure - clustering - addresses - settings] ******************************************
  fatal: [server]: FAILED! =&gt; {&quot;msg&quot;: &quot;The task includes an option with an undefined variable. The error was: 'dict object' has no attribute 'max_redelivery_delay'\n\nThe error appears to be in 'test5.yaml': line 58, column 5, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n  - name: configure - clustering - addresses - settings\n    ^ here\n&quot;}
  </code></pre>
  <p>Why do I get this error, max_redelivery_delay is not defined for the queue AAA.bbb and BBB.ccc but is defined for RRR.wwww.</p>