I’m struggling to find the best way to define a dictionary variable dynamically. My goal is to define a dictionary with product versions as keys and the latest revisions as values. That way I can define the path to the latest build for each product version.
It seems like a lookup plugin should be perfect, even though they’re required to return a list. I tried sending back the dictionary inside a list, but that fails with
“an unexpected type error occured. Error was sequence item 0: expected string, dict found”
I get this same error whether I use vars: or set_fact with complex arguments.
I then took a different approach and converted my lookup plugin to a module which defines a specific fact. This worked, but unfortunately the fact is scoped to each host, so the module has to run repeatedly. Is there a better way?