summaryrefslogtreecommitdiffstats
path: root/playbooks/openshift-node/private/restart.yml
blob: 7371bd7acd2e43fdd79f5a24461d9668abdb08ab (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
50
51
52
53
54
55
56
57
58
59
---
- name: Restart nodes
  hosts: oo_nodes_to_config
  serial: "{{ openshift_restart_nodes_serial | default(1) }}"

  roles:
  - lib_openshift
  - openshift_facts

  tasks:
  - name: Restart docker
    service:
      name: docker
      state: restarted
    register: l_docker_restart_docker_in_node_result
    until: not (l_docker_restart_docker_in_node_result is failed)
    retries: 3
    delay: 30
    when: openshift_node_restart_docker_required | default(True)

  - name: Restart containerized services
    service:
      name: "{{ item }}"
      state: started
    with_items:
    - etcd_container
    - openvswitch
    - "{{ openshift_service_type }}-master-api"
    - "{{ openshift_service_type }}-master-controllers"
    - "{{ openshift_service_type }}-node"
    failed_when: false
    when: openshift_is_containerized | bool

  - 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
    when: inventory_hostname in groups.oo_masters_to_config

  - name: restart node
    service:
      name: "{{ openshift_service_type }}-node"
      state: restarted

  - name: Wait for node to be ready
    oc_obj:
      state: list
      kind: node
      name: "{{ openshift.common.hostname | lower }}"
    register: node_output
    delegate_to: "{{ groups.oo_first_master.0 }}"
    when: inventory_hostname in groups.oo_nodes_to_config
    until: node_output.results.returncode == 0 and node_output.results.results[0].status.conditions | selectattr('type', 'match', '^Ready$') | map(attribute='status') | join | bool == True
    # Give the node two minutes to come back online.
    retries: 24
    delay: 5