blob: 9485cc3accafccc778621de78cc9fa49a5cedce0 (
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
---
# When openshift_aws_use_custom_ami is '' then
# we retrieve the latest build AMI.
# Then set openshift_aws_ami to the ami.
- when: openshift_aws_ami == ''
block:
- name: fetch recently created AMI
ec2_ami_find:
region: "{{ openshift_aws_region }}"
sort: creationDate
sort_order: descending
name: "{{ openshift_aws_ami_name }}*"
ami_tags: "{{ openshift_aws_ami_tags }}"
no_result_action: fail
register: amiout
- name: Set the openshift_aws_ami
set_fact:
openshift_aws_ami: "{{ amiout.results[0].ami_id }}"
when:
- "'results' in amiout"
- amiout.results|length > 0
# Need to set epoch time in one place to use for launch_config and scale_group
- set_fact:
l_epoch_time: "{{ ansible_date_time.epoch }}"
#
# query asg's and determine if we need to create the others.
# if we find more than 1 for each type, then exit
- name: query all asg's for this cluster
ec2_asg_facts:
region: "{{ openshift_aws_region }}"
tags: "{{ {'kubernetes.io/cluster/' ~ openshift_aws_clusterid: openshift_aws_clusterid} | combine(openshift_aws_node_group.tags) }}"
register: asgs
- fail:
msg: "Found more than 1 auto scaling group that matches the query for group: {{ openshift_aws_node_group }}"
when:
- asgs.results|length > 1
- debug:
msg: "{{ asgs }}"
- name: set the value for the deployment_serial and the current asgs
set_fact:
l_deployment_serial: "{{ openshift_aws_node_group_deployment_serial if openshift_aws_node_group_deployment_serial is defined else asgs.results | scale_groups_serial(openshift_aws_node_group_upgrade) }}"
openshift_aws_current_asgs: "{{ asgs.results | map(attribute='auto_scaling_group_name') | list | union(openshift_aws_current_asgs) }}"
- name: dump deployment serial
debug:
msg: "Deployment serial: {{ l_deployment_serial }}"
- name: dump current_asgs
debug:
msg: "openshift_aws_current_asgs: {{ openshift_aws_current_asgs }}"
- when: openshift_aws_create_iam_role
include_tasks: iam_role.yml
- when: openshift_aws_create_launch_config
include_tasks: launch_config.yml
- when: openshift_aws_create_scale_group
include_tasks: scale_group.yml
|