Error when try to iterate a list:
This is what I am using in the playbook:
...
- debug: msg="{{ dev_interfaces[0].name }}"
- name: debug message interface name
debug: msg="{{item.name}}"
with_items: "{{ dev_interfaces }}"
...
When executing, the loop always get error, any suggestion?
TASK [debug msg={{ dev_interfaces[0].name }}] ****************************
ok: [10.3.146.113] => {
"changed": false,
"invocation": {
"module_args": {
"msg": "Ethernet0"
},
"module_name": "debug"
},
"msg": "Ethernet0"
}
TASK [debug message interface name] **********************************
fatal: [10.3.146.113]: FAILED! => {"failed": true, "msg": "ERROR! dict
object has no element {u'subnet': u'10.0.0.0/31', u'peer_addr':
u'10.0.0.1', u'name': u'Ethernet0', u'mask': u'255.255.255.254',
u'prefixlen': 31, u'addr': u'10.0.0.0'}"}
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/a25eb6e2-154f-4b4c-892c-e2304da50973%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.