summaryrefslogtreecommitdiffstats
path: root/playbooks/aws/openshift-cluster/build_node_group.yml
blob: 5b0330e46264c43569e28276850950186c670af6 (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
48
---
- name: fetch recently created AMI
  ec2_ami_find:
    region: "{{ openshift_region }}"
    sort: creationDate
    sort_order: descending
    name: "{{ openshift_ami_name }}*"
    ami_tags: "{{ openshift_ami_tags }}"
    #no_result_action: fail
  register: amiout
  when: not openshift_use_custom_ami

- block:
  - name: "Create {{ openshift_build_node_type }} sgs"
    include_role:
      name: openshift_aws_sg
    vars:
      r_openshift_aws_sg_clusterid: "{{ openshift_clusterid }}"
      r_openshift_aws_sg_region: "{{ openshift_region }}"
      r_openshift_aws_sg_type: "{{ openshift_build_node_type }}"

  - name: "generate a launch config name for {{ openshift_build_node_type }}"
    set_fact:
      launch_config_name: "{{ openshift_clusterid }}-{{ openshift_build_node_type }}-{{ ansible_date_time.epoch }}"

  - name: create "{{ openshift_build_node_type }} launch config"
    include_role:
      name: openshift_aws_launch_config
    vars:
      r_openshift_aws_launch_config_name: "{{ launch_config_name }}"
      r_openshift_aws_launch_config_clusterid: "{{ openshift_clusterid }}"
      r_openshift_aws_launch_config_region: "{{ openshift_region }}"
      r_openshift_aws_launch_config: "{{ openshift_node_group_config }}"
      r_openshift_aws_launch_config_type: "{{ openshift_build_node_type }}"
      r_openshift_aws_launch_config_custom_image: "{{ '' if 'results' not in amiout and amiout.results|length > 0 else amiout.results[0].ami_id }}"
      r_openshift_aws_launch_config_bootstrap_token: "{{ (local_bootstrap['content'] |b64decode) if local_bootstrap is defined else '' }}"

  - name: "create {{ openshift_build_node_type }} node groups"
    include_role:
      name: openshift_aws_node_group
    vars:
      r_openshift_aws_node_group_name: "{{ openshift_clusterid }} openshift {{ openshift_build_node_type }}"
      r_openshift_aws_node_group_lc_name: "{{ launch_config_name }}"
      r_openshift_aws_node_group_clusterid: "{{ openshift_clusterid }}"
      r_openshift_aws_node_group_region: "{{ openshift_region }}"
      r_openshift_aws_node_group_config: "{{ openshift_node_group_config }}"
      r_openshift_aws_node_group_type: "{{ openshift_build_node_type }}"
      r_openshift_aws_node_group_subnet_name: "{{ openshift_subnet_name }}"