summaryrefslogtreecommitdiffstats
path: root/roles/openshift_aws_node_group/tasks/main.yml
blob: 6f5364b032280679604f47633916dceda0d7bf1f (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
---
- name: validate role inputs
  fail:
    msg: Please pass in the required role variables
  when:
  - r_openshift_aws_node_group_clusterid is not defined
  - r_openshift_aws_node_group_region is not defined
  - r_openshift_aws_node_group_subnet_name is not defined

- name: fetch the subnet to use in scale group
  ec2_vpc_subnet_facts:
    region: "{{ r_openshift_aws_node_group_region }}"
    filters:
      "tag:Name": "{{ r_openshift_aws_node_group_subnet_name }}"
  register: subnetout

- name: Create the scale group
  ec2_asg:
    name: "{{ r_openshift_aws_node_group_name }}"
    launch_config_name: "{{ r_openshift_aws_node_group_lc_name }}"
    health_check_period: "{{ r_openshift_aws_node_group_config[r_openshift_aws_node_group_type].health_check.period }}"
    health_check_type: "{{ r_openshift_aws_node_group_config[r_openshift_aws_node_group_type].health_check.type }}"
    min_size: "{{ r_openshift_aws_node_group_config[r_openshift_aws_node_group_type].min_size }}"
    max_size: "{{ r_openshift_aws_node_group_config[r_openshift_aws_node_group_type].max_size }}"
    desired_capacity: "{{ r_openshift_aws_node_group_config[r_openshift_aws_node_group_type].desired_size }}"
    region: "{{ r_openshift_aws_node_group_region }}"
    termination_policies: "{{ r_openshift_aws_node_group_config[r_openshift_aws_node_group_type].termination_policy if 'termination_policy' in  r_openshift_aws_node_group_config[r_openshift_aws_node_group_type] else omit }}"
    load_balancers: "{{ r_openshift_aws_node_group_config[r_openshift_aws_node_group_type].elbs if 'elbs' in r_openshift_aws_node_group_config[r_openshift_aws_node_group_type] else omit }}"
    wait_for_instances: "{{ r_openshift_aws_node_group_config[r_openshift_aws_node_group_type].wait_for_instances | default(False)}}"
    vpc_zone_identifier: "{{ subnetout.subnets[0].id }}"
    tags:
    - "{{ r_openshift_aws_node_group_config.tags | combine(r_openshift_aws_node_group_config[r_openshift_aws_node_group_type].tags) }}"