summaryrefslogtreecommitdiffstats
path: root/roles/openshift_aws/tasks/setup_master_group.yml
blob: 700917ef4e367c2a431ba76f01a629bcde3ffc79 (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: Alert user to variables needed - clusterid
  debug:
    msg: "openshift_aws_clusterid={{ openshift_aws_clusterid }}"

- name: Alert user to variables needed - region
  debug:
    msg: "openshift_aws_region={{ openshift_aws_region }}"

- name: fetch newly created instances
  ec2_instance_facts:
    region: "{{ openshift_aws_region }}"
    filters:
      "tag:clusterid": "{{ openshift_aws_clusterid }}"
      "tag:host-type": master
      instance-state-name: running
  register: instancesout
  retries: 20
  delay: 3
  until: instancesout.instances|length > 0

- debug: var=instancesout

- name: add new master to masters group
  add_host:
    groups: "{{ openshift_aws_masters_groups }}"
    name: "{{ item.public_dns_name }}"
    hostname: "{{ openshift_aws_clusterid }}-master-{{ item.instance_id[:-5] }}"
  with_items: "{{ instancesout.instances }}"

- name: wait for ssh to become available
  wait_for:
    port: 22
    host: "{{ item.public_dns_name }}"
    timeout: 300
    search_regex: OpenSSH
  with_items: "{{ instancesout.instances }}"