summaryrefslogtreecommitdiffstats
path: root/roles/openshift_aws/tasks/launch_config.yml
blob: 8b7b02a0ed9891f79c37b85060d7a8a4444d9326 (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
---
- fail:
    msg: "Ensure that an AMI value is defined for openshift_aws_ami or openshift_aws_launch_config_custom_image."
  when:
  - openshift_aws_ami is undefined

- fail:
    msg: "Ensure that openshift_deployment_type is defined."
  when:
  - openshift_deployment_type is undefined

- name: query vpc
  ec2_vpc_net_facts:
    region: "{{ openshift_aws_region }}"
    filters:
      'tag:Name': "{{ openshift_aws_vpc_name }}"
  register: vpcout

- name: fetch the security groups for launch config
  ec2_group_facts:
    filters:
      group-name: "{{ openshift_aws_launch_config_security_groups }}"
      vpc-id: "{{ vpcout.vpcs[0].id }}"
    region: "{{ openshift_aws_region }}"
  register: ec2sgs

# Create the scale group config
- name: Create the node scale group launch config
  ec2_lc:
    name: "{{ openshift_aws_launch_config_name }}"
    region: "{{ openshift_aws_region }}"
    image_id: "{{ openshift_aws_ami }}"
    instance_type: "{{ openshift_aws_node_group_config[openshift_aws_node_group_type].instance_type }}"
    security_groups: "{{ openshift_aws_launch_config_security_group_id  | default(ec2sgs.security_groups | map(attribute='group_id')| list) }}"
    user_data: "{{ lookup('template', 'user_data.j2') }}"
    key_name: "{{ openshift_aws_ssh_key_name }}"
    ebs_optimized: False
    volumes: "{{ openshift_aws_node_group_config[openshift_aws_node_group_type].volumes }}"
    assign_public_ip: True