blob: 14c5246c91b74e85799fd42397dae0a5607ae596 (
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
|
---
- name: fetch all created instances
ec2_instance_facts:
region: "{{ openshift_aws_region }}"
filters:
"{{ {'tag:kubernetes.io/cluster/' ~ openshift_aws_clusterid: openshift_aws_clusterid,
'instance-state-name': 'running'} }}"
register: qinstances
# The building of new and current groups is dependent of having a list of the current asgs and the created ones
# that can be found in the variables: openshift_aws_created_asgs, openshift_aws_current_asgs. If these do not exist, we cannot determine which hosts are
# new and which hosts are current.
- name: Build new node group
add_host:
groups: oo_sg_new_nodes
ansible_ssh_host: "{{ item.public_dns_name }}"
name: "{{ item.public_dns_name }}"
hostname: "{{ item.public_dns_name }}"
when:
- openshift_aws_created_asgs != []
- "'aws:autoscaling:groupName' in item.tags"
- item.tags['aws:autoscaling:groupName'] in openshift_aws_created_asgs
- "'node' in item.tags['host-type']"
with_items: "{{ qinstances.instances }}"
- name: dump openshift_aws_current_asgs
debug:
msg: "{{ openshift_aws_current_asgs }}"
- name: Build current node group
add_host:
groups: oo_sg_current_nodes
ansible_ssh_host: "{{ item.public_dns_name }}"
name: "{{ item.public_dns_name }}"
hostname: "{{ item.public_dns_name }}"
when:
- openshift_aws_current_asgs != []
- "'aws:autoscaling:groupName' in item.tags"
- item.tags['aws:autoscaling:groupName'] in openshift_aws_current_asgs
- "'node' in item.tags['host-type']"
with_items: "{{ qinstances.instances }}"
- name: place all nodes into nodes group
add_host:
groups: nodes
ansible_ssh_host: "{{ item.public_dns_name }}"
name: "{{ item.public_dns_name }}"
hostname: "{{ item.public_dns_name }}"
with_items: "{{ qinstances.instances }}"
|