Hi,

The ec2_vpc module is used to create/change both VPCs and its subnets.

A with_items iterator on ec2_vpc, as expected, will call ec2_vpc as many 
times as there are items in the loop. 

This means there is no way to add a with_items to the subnets parameter 
inside ec2_vpc

It is possible to create subnets variable independently from the call to 
ec2_vpc, and use that, however I am struggling to create the list I need:

I have something like:

Variables:

    - stack: "atlas"    - env: "dev"    - app: "core"    - visibility: 
"private"    - subnet_parameters:        - cidr: "10.220.220.0/24"          
availability_zone: "ap-southeast-2a"
          suffix: "A"
        - cidr: "10.220.221.0/24"          availability_zone: "ap-southeast-2b"
          suffix: "B"

Any idea on how would I be able to generate something like this, from those 
variables? set_fact seems as if its not designed for loops?

  - module or something else here?
    - cidr: "{{ item.cidr }}"
      az: "{{ item.availability_zone }}"
      resource_tags:
        Name: "{{ app }} {{ stack }} {{ env }} {{ item.suffix }} subnet",
        stack: "{{ stack }}",
        environment: "{{ env }}",
        application: "{{ app }}",
        visibility: "{{ visibility }}"
      with_items: "{{ subnet_parameters }}"

Thanks so much,

Steve

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/659b272f-de06-4571-bda4-9af452a06c22%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to