summaryrefslogtreecommitdiffstats
path: root/roles/openshift_aws/tasks/setup_scale_group_facts.yml
blob: d65fdc2de44f280645df129dde0276a4aa6686a7 (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
---
- name: group scale group nodes
  ec2_remote_facts:
    region: "{{ openshift_aws_region }}"
    filters:
      "{{ {'tag:kubernetes.io/cluster/' ~ openshift_aws_clusterid: openshift_aws_clusterid }}}"
  register: qinstances

- 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:
  - (item.tags.version | default(False)) == openshift_aws_new_version
  - "'node' in item.tags['host-type']"
  with_items: "{{ qinstances.instances }}"

- 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:
  - (item.tags.version | default('')) == openshift_aws_current_version
  - "'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 }}"