summaryrefslogtreecommitdiffstats
path: root/roles/openshift_aws/tasks/scale_group.yml
blob: 097859af2465e172be61e8db8e8d8beddcbfc3e7 (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
---
- name: fetch the subnet to use in scale group
  ec2_vpc_subnet_facts:
    region: "{{ openshift_aws_region }}"
    filters:
      "tag:Name": "{{ openshift_aws_subnet_name }}"
      vpc-id: "{{ vpcout.vpcs[0].id }}"
  register: subnetout

- name: Create the scale group
  ec2_asg:
    name: "{{ openshift_aws_scale_group_basename }} {{ item.key }}"
    launch_config_name: "{{ openshift_aws_launch_config_basename }}-{{ item.key }}-{{ l_epoch_time }}"
    health_check_period: "{{ item.value.health_check.period }}"
    health_check_type: "{{ item.value.health_check.type }}"
    min_size: "{{ item.value.min_size }}"
    max_size: "{{ item.value.max_size }}"
    desired_capacity: "{{ item.value.desired_size }}"
    region: "{{ openshift_aws_region }}"
    termination_policies: "{{ item.value.termination_policy if 'termination_policy' in  item.value else omit }}"
    load_balancers: "{{ item.value.elbs if 'elbs' in item.value else omit }}"
    wait_for_instances: "{{ item.value.wait_for_instances | default(False)}}"
    vpc_zone_identifier: "{{ subnetout.subnets[0].id }}"
    replace_instances: "{{ openshift_aws_node_group_replace_instances if openshift_aws_node_group_replace_instances != [] else omit }}"
    replace_all_instances: "{{ omit if openshift_aws_node_group_replace_instances != [] else (item.value.replace_all_instances | default(omit)) }}"
    tags:
    - "{{ openshift_aws_node_group_config_tags | combine(item.value.tags) }}"
  with_dict: "{{ l_nodes_to_build }}"