Let's say I create an ec2 vpc like this:
tasks:
- name: create a vpc
ec2_vpc:
internet_gateway: True
resource_tags: { env: production }
cidr_block: 10.0.0.0/16
subnets:
- cidr: 10.0.0.0/24
resource_tags:
env: production
tier: web
- cidr: 10.0.1.0/24
resource_tags:
env: production
tier: db
route_tables:
- subnets:
- 10.0.0.0/24
- 10.0.1.0/24
routes:
- dest: 0.0.0.0/0
gw: igw
register: vpc
Later in the play, I want to create an instance inside of subnet
10.0.0.0/24 (web tier):
ec2:
image: "{{ ubuntu_image.ami }}"
instance_type: "{{ instance_type }}"
assign_public_ip: True
key_name: mykey
group: [web, ssh]
instance_tags: { type: web, env: production }
exact_count: "{{ count }}"
count_tag: { type: web }
vpc_subnet_id: "{{ vpc.subnets[0].id}}"
Is vpc.subnets[0] guaranteed to correspond to the first subnet that was
created (10.0.0.0/24)? If not, is there a way I can specify "the vpc subnet
that corresponds to resource tag {env: production, tier: web}?"
Lorin
--
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/f83942f0-2471-40b7-a12c-ff5feb9d3f62%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.