I am trying to create a play that defines by VPC infrastructure. I have a
number of environments that are all set up in the same way but with
different subnets. I'm trying to loop over a dict for each environment and
then within that loop, loop to create by cidr subnets. However, it fails
with an error "unsupported parameter for module: with_sequence".
I'm using the ipaddr custom filter.
I'm not sure quite how I would access my with_sequence item even if this
did work. Would it be item[1]?
My play is below...
---
- name: VPC infrastructure
hosts: local
connection: local
gather_facts: false
vars:
environments:
prod:
vpc_cidr_block: 10.0.0.0/21
availability_zones: 2
android:
vpc_cidr_block: 10.0.8.0/21
availability_zones: 2
tasks:
- name: Create VPC
local_action:
module: ec2_vpc
state: present
region: "{{ aws_region }}"
cidr_block: "{{ item.value.vpc_cidr_block }}"
subnets:
- cidr: "{{ item.value.vpc_cidr_block | ipsubnet(24, 0) }}"
with_sequence: count={{ item.value.availability_zones }}
resource_tags: { "env": "{{ item.key }}" }
wait: yes
with_dict: environments
register: vpc
Any pointers appreciated.
--
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/270b38c1-1cff-42c5-aa3f-7eadfc82f1db%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.