I'm trying to iterate through nested loops, much like this question:
Ansible with_subelements
I need to go an extra level deep though. The comment there (dated January 2017) states that additional levels of nesting are unsupported. Is this still the case? If not, how can I reference deeper levels?
My data:
dns:
- name: Something
prefix: st
zones:
- zone: something.com
records:
- record: testing.something.com
type: TXT
value: '"somethingtest"'
ttl: 60
- name: Devthing
prefix: dt
zones:
- zone: devthing.com
records:
- record: testing.devthing.com
type: TXT
value: '"devthingtest"'
ttl: 60
- zone: testthing.com
records:
- record: testing.testthing.com
type: TXT
value: '"testthingtest"'
ttl: 60
- record: thingy.testthing.com
type: TXT
value: '"testthingthingytest"'
ttl: 60
My task:
- name: Create DNS records
route53:
state: present
zone: "{{ item.0.zone }}"
record: "{{ item.1.record }}"
type: "{{ item.1.type }}"
ttl: "{{ item.1.ttl }}"
value: "{{ item.1.value }}"
with_subelements:
- "{{ dns }}"
- records
Zones, users and access policies are successfully created since they don't need to go that extra level deep (records level).