title: Ansible: can't access dictionary value - got error: 'dict object' has no attribute
body: <pre><code>---
  - hosts: test
    tasks:
      - name: print phone details
        debug: msg=&quot;user {{ item.key }} is {{ item.value.name }} ({{ item.value.telephone }})&quot;
        with_dict: &quot;{{ users }}&quot;
    vars:
      users:
        alice: &quot;Alice&quot;
        telephone: 123
  </code></pre>
  <p>When I run this playbook, I am getting this error:</p>
  <pre><code>One or more undefined variables: 'dict object' has no attribute 'name' 
  </code></pre>
  <p>This one actually works just fine:</p>
  <pre><code>debug: msg=&quot;user {{ item.key }} is {{ item.value }}&quot;
  </code></pre>
  <p>What am I missing?</p>