summaryrefslogtreecommitdiffstats
path: root/roles/openshift_aws/tasks/elb.yml
blob: 56abe9dd7ea47c4eaf19ce08ebbaa49395bc3a82 (plain)
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
---
- name: query vpc
  ec2_vpc_net_facts:
    region: "{{ openshift_aws_region }}"
    filters:
      'tag:Name': "{{ openshift_aws_vpc_name }}"
  register: vpcout

- name: debug
  debug: var=vpcout

- name: fetch the default subnet id
  ec2_vpc_subnet_facts:
    region: "{{ openshift_aws_region }}"
    filters:
      "tag:Name": "{{ openshift_aws_subnet_name }}"
      vpc-id: "{{ vpcout.vpcs[0].id }}"
  register: subnetout

- name: dump the elb listeners
  debug:
    msg: "{{ openshift_aws_elb_listeners[openshift_aws_node_group_type][openshift_aws_elb_direction]
                   if 'master' in openshift_aws_node_group_type or 'infra' in openshift_aws_node_group_type
                   else openshift_aws_elb_listeners }}"

- name: "Create ELB {{ l_openshift_aws_elb_name }}"
  ec2_elb_lb:
    name: "{{ l_openshift_aws_elb_name }}"
    state: present
    cross_az_load_balancing: "{{ openshift_aws_elb_az_load_balancing }}"
    security_group_names: "{{ openshift_aws_elb_security_groups }}"
    idle_timeout: "{{ openshift_aws_elb_idle_timout }}"
    region: "{{ openshift_aws_region }}"
    subnets:
    - "{{ subnetout.subnets[0].id }}"
    health_check: "{{ openshift_aws_elb_health_check }}"
    listeners: "{{ openshift_aws_elb_listeners[openshift_aws_node_group_type][openshift_aws_elb_direction]
                   if 'master' in openshift_aws_node_group_type  or 'infra' in openshift_aws_node_group_type
                   else openshift_aws_elb_listeners }}"
    scheme: "{{ openshift_aws_elb_scheme }}"
    tags: "{{ openshift_aws_elb_tags }}"
  register: new_elb

- debug:
    msg: "{{ item }}"
  with_items:
  - "{{ new_elb }}"