Ansible: can't access dictionary value - got error: 'dict object' has no attribute

This is not the exact same code. If you look carefully at the example, you'll see that under users, you have several dicts.

In your case, you have two dicts but with just one key (alice, or telephone) with respective values of "Alice", 123.

You'd rather do :

- hosts: localhost
  gather_facts: no
  tasks:
    - name: print phone details
      debug: msg="user {{ item.key }} is {{ item.value.name }} ({{ item.value.telephone }})"
      with_dict: "{{ users }}"
  vars:
    users:
      alice:
        name: "Alice"
        telephone: 123

(note that I changed host to localhost so I can run it easily, and added gather_facts: no since it's not necessary here. YMMV.)