I am using a template that I supply items to with “with_items”, and I reference the data as “item”. If I use “with_dict”, then the template has to be duplicated and “item” changed to “item.key”. In this example I would like to get a list containing web01 and web02 from the dict hosts.
I would like to do something like:
with_items: hosts.key
when: item[:3] == ‘web’
Thank you Matt! hosts.keys() is exactly what I was looking for. I’ve been using hosts as the dict name for almost a year with no known issues, but I’m going to follow your advice and rename it as soon as I get a chance, thanks for the suggestion.