Commit 682fbf54 by Kevin Falcone

Merge pull request #2020 from edx/jibsheet/multiple-elbs

Support creating 0-many ELBs at once from a service configuration
parents a7086a6f c6a499bc
...@@ -106,19 +106,41 @@ ...@@ -106,19 +106,41 @@
# vpc_id: "{{ vpc_id }}" # vpc_id: "{{ vpc_id }}"
# destination_cidr: "{{ rt.destination_cidr }}" # destination_cidr: "{{ rt.destination_cidr }}"
# target: "local" # simplifying generalization of instnace-id, gateway-id or local # target: "local" # simplifying generalization of instnace-id, gateway-id or local
#
- name: Manage Private ELB Subnets
ec2_subnet:
profile: "{{ profile }}"
state: "{{ state }}"
region: "{{ aws_region }}"
name: "{{ item.name }}"
vpc_id: "{{ vpc_id }}"
cidr_block: "{{ item.cidr }}"
az: "{{ item.az }}"
route_table_id: "{{ item.route_table_id }}"
tags: "{{ item.tags }}"
register: created_elb_private_subnets
with_items: elb_private_subnets
when: private_elb_subnet_1 is defined and private_elb_subnet_2 is defined
- name: Check that internal ELBs have subnets
fail: msg="If you set an elb scheme to 'internal' you must also define private_elb_subnet_1 and private_elb_subnet_2"
when: private_elb_subnet_1 is not defined and private_elb_subnet_2 is not defined and elbs is defined and 'internal' in elbs|map(attribute='scheme')|list
- name: Manage ELB - name: Manage ELB
ec2_elb_lb: ec2_elb_lb:
profile: "{{ profile }}" profile: "{{ profile }}"
region: "{{ aws_region }}" region: "{{ aws_region }}"
scheme: "{{ elb_scheme }}" scheme: "{{ item.scheme }}"
name: "{{ elb_name }}" name: "{{ item.name}}"
state: "{{ state }}" state: "{{ state }}"
security_group_ids: "{{ elb_sec_group.group_id }}" security_group_ids: "{{ elb_sec_group.group_id }}"
subnets: "{{ elb_subnets }}" subnets: "{{ created_elb_private_subnets.results|map(attribute='subnet_id')| list if ( item.scheme == 'internal' ) else elb_subnets}}"
health_check: "{{ elb_healthcheck }}" health_check: "{{ elb_healthcheck }}"
listeners: "{{ elb_listeners }}" listeners: "{{ elb_listeners }}"
register: elb register: created_elbs
with_items: elbs
when: elbs is defined
# #
# Service related components # Service related components
# #
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment