summaryrefslogtreecommitdiffstats
path: root/roles/openshift_aws/tasks/accept_nodes.yml
blob: cc0cdcb0b778bca8d877fcb9b286f439a37797b4 (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
---
- include_tasks: setup_master_group.yml

- name: fetch masters
  ec2_instance_facts:
    region: "{{ openshift_aws_region | default('us-east-1') }}"
    filters:
      "{{ {'tag:kubernetes.io/cluster/' ~ openshift_aws_clusterid: openshift_aws_clusterid,
           'tag:host-type': 'master', 'instance-state-name': 'running'} }}"
  register: mastersout
  retries: 20
  delay: 3
  until: "'instances' in mastersout and mastersout.instances|length > 0"

- name: fetch new node instances
  ec2_instance_facts:
    region: "{{ openshift_aws_region }}"
    filters:
      "{{ {'tag:kubernetes.io/cluster/' ~ openshift_aws_clusterid: openshift_aws_clusterid,
           'tag:host-type': 'node',
           'instance-state-name': 'running'} }}"
  register: instancesout
  retries: 20
  delay: 3
  until: "'instances' in instancesout and instancesout.instances|length > 0"

- name: Dump the private dns names
  debug:
    msg: "{{ instancesout.instances|map(attribute='private_dns_name') | list }}"

- name: Dump the master public ip address
  debug:
    msg: "{{ mastersout.instances[0].public_ip_address }}"

- name: approve nodes
  oc_adm_csr:
    #approve_all: True
    nodes: "{{ instancesout.instances|map(attribute='private_dns_name') | list  }}"
    timeout: 60
    fail_on_timeout: "{{ openshift_aws_node_accept_fail_on_timeout | default(false) | bool }}"
  register: nodeout
  delegate_to: "{{ groups.masters.0 }}"