get cloudformation_facts for multiple cloudformation stacks with with_items in ansible -
i have multiple clouformation stacks, , stored names list in cf_template_items
now trying gather information of them (at end want have stack_output of of them):
- name: facts cf stacks cloudformation_facts: stack_name: "{{ item }}" with_items: "{{ cf_template_items }}"
unfortunately, afterwards cloudformation
contains information last stack. seems information others overwritten.
can somehow cat facts cloudformation stacks of list of stack names?
yes, cloudformation_facts
overwrites cloudformation
fact every run.
to collect data every run, register
loop result , reformat clean dict, this:
- cloudformation_facts: stack_name: "{{ item }}" with_items: "{{ cf_template_items }}" register: cf_tmp - set_fact: cf: "{{ dict(cf_tmp.results | map(attribute='ansible_facts.cloudformation') | map('dictsort') | sum(start=[])) }}"
this code not tested. should give cf
dict stacks facts keys.
Comments
Post a Comment