Hi, I have been looking into nested , subelements and other lookups with no luck to make this working , using ansible 2.8.
Basically , I’d like to construct a loop than can itself iterate over other variables (list or dict).
so, I have been trying with lookup(‘dict’) but still not quite close to the expected result
I get: " An unhandled exception occurred while running the lookup plugin ‘dict’. Error was a <class ‘ansible.errors.AnsibleError’>, original message: with_dict expects a dict"
her is the last code :
so, I have been trying with lookup('dict') but still not quite close to the expected result
I get: " An unhandled exception occurred while running the lookup plugin 'dict'. Error was a <class
'ansible.errors.AnsibleError'>, original message: with_dict expects a dict"
her is the last code :
Thanks Racke, I should have had some context. policy_name can vary, actually in the real task I have other policies with other names, hence the use of a loop for item.name and item.policy .
Just this specific one named rds_foo_bar needs the nested arguments from my vars list(or dict I am not sure) .
Although I can create a dedicate task just for that policy if that is too complicated, I just thought I could do some nested loop over variables.
Interesting facts, with nested it actually loop over each character in the key:value Couldn’t create policy rds-dev-[[u’r’, u’e’, u’g’, u’i’, u’o’, u’n’, u’s’], [u’r’, u’o’, u’l’, u’e’]]
so basically I just need to loop over extra variables in an inline way to construct the unique name and the unique policy template, then, the usual loop for the module will create the resources in aws.
should using Lookup a good start for inline loop ?
as nested and subelements can’t seem to achieve this, what other solution I can explore ?