Hi guys,
I wonder if anyone knows if it's possible do use the 'in' clause with a
list of dicts.
I have a list that looks like this:
[{u'state': None, u'id': u'i-233b31yy'}, {u'state': None, u'id':
u'i-2a2281xx'}]
I want to add_host if an id is not in the list, something like:
vars:
mylist:
- {u'state': None, u'id': u'i-233b31yy'}
- {u'state': None, u'id': u'i-2a2281xx'}
tasks:
local_action:
module: add_host
name: "{{ ansible_ec2_local_ipv4 }}"
group: not_in_elb
when: ansible_ec2_instance_id not in mylist
The above fails because the list items are dicts. How can I just look at
the id value of each dict in the list?
--
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/49ce10fc-2b25-4187-97e3-6c25b5b509a7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.