This repository has been archived by the owner on Jan 24, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
/
main.yml
56 lines (52 loc) · 2.02 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
---
# tasks file for aws.ec2-loadbalancer
- name: Create ELB Security group
ec2_group:
name: "{{ elb_cluster_name }}-{{ elb_service_name }}-lb"
description: "{{ elb_sg_description }}"
state: present
region: "{{ aws_region }}"
profile: "{{ aws_profile }}"
rules: "{{ elb_sg_rules }}"
purge_rules: "{{ elb_sg_purge_rules }}"
purge_rules_egress: "{{ elb_sg_purge_rules_egress }}"
vpc_id: "{{ elb_vpc_id }}"
register: _elb_sg_info
- name: Tag ELB Security Group
ec2_tag:
resource: "{{ _elb_sg_info.group_id }}"
region: "{{ aws_region }}"
profile: "{{ aws_profile }}"
state: present
tags:
Name: "{{ elb_cluster_name }}-{{ elb_service_name }}-lb"
ClusterName: "{{ elb_cluster_name }}"
EcsServiceName: "{{ elb_service_name }}"
- name: create load balancer
ec2_elb_lb:
profile: "{{ aws_profile }}"
region: "{{ aws_region }}"
name: "{{ elb_cluster_name }}-{{ elb_service_name }}-lb"
state: present
subnets: "{{ elb_subnets | join(',') }}"
security_group_names: "['{{ elb_cluster_name }}-{{ elb_service_name }}-lb']"
connection_draining_timeout: "{{ elb_connection_draining_timeout }}"
cross_az_load_balancing: "{{ elb_cross_az_load_balancing }}"
idle_timeout: "{{ elb_idle_timeout | default(omit) }}"
scheme: "{{ elb_scheme }}"
listeners: "{{ elb_listeners }}"
stickiness: "{{ elb_stickiness | default(omit) }}"
health_check: "{{ elb_health_check | default(omit) }}"
zones: "{{ elb_zones | default(omit) }}"
access_logs: "{{ elb_access_logs | default(omit) }}"
tags:
Name: "{{ elb_cluster_name }}-{{ elb_service_name }}-lb"
ClusterName: "{{ elb_cluster_name }}"
EcsServiceName: "{{ elb_service_name }}"
register: _elb_load_balancer
- name: Extract load balancer parameters from elb module
set_fact:
_elb_ecs_load_balancers:
- loadBalancerName: "{{ elb_cluster_name }}-{{ elb_service_name }}-lb"
containerName: "{{ elb_container_name }}"
containerPort: "{{ elb_container_port }}"