---
- hosts: test
tasks:
- name: print phone details
debug: msg="user {{ item.key }} is {{ item.value.name }} ({{ item.value.telephone }})"
with_dict: users
vars:
users:
alice: "Alice"
telephone: 123
Quando eseguo questo playbook, sto ottenendo questo errore:Ansible: non può accedere valore dizionario - ha ottenuto l'errore: 'oggetto dict' non ha alcun attributo
One or more undefined variables: 'dict object' has no attribute 'name'
Questo in realtà funziona bene :
debug: msg="user {{ item.key }} is {{ item.value }}"
Cosa mi manca?
Oh, errore di battitura ... grazie! – user1692261