summaryrefslogtreecommitdiffstats
path: root/roles/openshift_node/tasks/upgrade.yml
blob: ede73f22c1451c19ddf5b34713e13acdf142ce6f (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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
---
# input variables:
# - l_docker_upgrade
# - openshift.common.is_atomic
# - node_config_hook
# - openshift_pkg_version
# - openshift.common.is_containerized
# - deployment_type
# - openshift_release

# tasks file for openshift_node_upgrade

- name: Stop node and openvswitch services
  service:
    name: "{{ item }}"
    state: stopped
  with_items:
  - "{{ openshift_service_type }}-node"
  - openvswitch
  failed_when: false

- name: Ensure containerized services stopped before Docker restart
  service:
    name: "{{ item }}"
    state: stopped
  with_items:
  - etcd_container
  - openvswitch
  - "{{ openshift_service_type }}-master-api"
  - "{{ openshift_service_type }}-master-controllers"
  - "{{ openshift_service_type }}-node"
  failed_when: false
  when: openshift.common.is_containerized | bool

- service:
    name: docker
    state: stopped
  register: l_openshift_node_upgrade_docker_stop_result
  until: not l_openshift_node_upgrade_docker_stop_result | failed
  retries: 3
  delay: 30
  when:
  - l_docker_upgrade is defined
  - l_docker_upgrade | bool

- name: Stop rpm based services
  service:
    name: "{{ item }}"
    state: stopped
  with_items:
  - "{{ openshift_service_type }}-node"
  - openvswitch
  failed_when: false
  when: not openshift.common.is_containerized | bool

- include_tasks: "{{ node_config_hook }}"
  when: node_config_hook is defined

# https://bugzilla.redhat.com/show_bug.cgi?id=1513054
- name: Clean up dockershim data
  file:
    path: "/var/lib/dockershim/sandbox/"
    state: absent

- name: Disable swap
  command: swapoff --all
  when:
  - openshift_node_upgrade_swap_result | default(False) | bool
  - openshift_disable_swap | default(true) | bool
  # End Disable Swap Block

- name: Reset selinux context
  command: restorecon -RF {{ openshift_node_data_dir }}/openshift.local.volumes
  when:
  - ansible_selinux is defined
  - ansible_selinux.status == 'enabled'

# Restart all services
- include_tasks: upgrade/restart.yml

- 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 }}"
  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

- include_tasks: dnsmasq.yml

- meta: flush_handlers