I have a use-case where a hash is populated with entries from combinations of host/groups variables resulting in something that (simplified) looks like : https://gist.github.com/alisaifee/343512d19714375c0fd8. I want to give the items in ‘sublist’ the same treatment with respect to the ‘name’ key in each hash entry - so essentially I want to implement one task that uses a with_* to iterate over all the sublists combined and also have access to the ‘name’ value in each iteration.
I’m really hoping theres something obvious that I’ve missed
There’s already a RFE ticket for adding a lookup plugin for something like this.
Stay tuned!
out of desperation i went with a filter plugin that looks like : https://gist.github.com/alisaifee/9409e65b808ff005b027 (im not even sure if the name makes sense)
used as :
task:
… ${item.key} … ${item.value}
with_items: “{{thing | zipped_hash(‘key_lookup’,‘list_lookup’)}}”
as always , looking forward to deleting my ./custom folder
This shouldn’t be a filter plugin, it should be a new lookup plugin.
with_items is one, as is with_nested
Take a look!