summaryrefslogtreecommitdiffstats
path: root/playbooks/openshift-master/private/tasks/restart_hosts.yml
blob: a5dbe0590dd48ecfc72c2180074185900583329a (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
---
- name: Restart master system
  # https://github.com/ansible/ansible/issues/10616
  shell: sleep 2 && shutdown -r now "OpenShift Ansible master rolling restart"
  async: 1
  poll: 0
  ignore_errors: true
  become: yes

# WARNING: This process is riddled with weird behavior.

# Workaround for https://github.com/ansible/ansible/issues/21269
- set_fact:
    wait_for_host: "{{ ansible_host }}"

# Ansible's blog documents this *without* the port, which appears to now
# just wait until the timeout value and then proceed without checking anything.
# port is now required.
#
# However neither ansible_ssh_port or ansible_port are reliably defined, likely
# only if overridden. Assume a default of 22.
- name: Wait for master to restart
  local_action:
    module: wait_for
      host="{{ wait_for_host }}"
      state=started
      delay=10
      timeout=600
      port="{{ ansible_port | default(ansible_ssh_port | default(22,boolean=True),boolean=True) }}"
  become: no

# Now that ssh is back up we can wait for API on the remote system,
# avoiding some potential connection issues from local system:
- name: Wait for master API to come back online
  wait_for:
    host: "{{ openshift.common.hostname }}"
    state: started
    delay: 10
    port: "{{ openshift.master.api_port }}"
    timeout: 600