summaryrefslogtreecommitdiffstats
path: root/roles/openshift_node_upgrade/tasks/main.yml
blob: b1d5f0e0f280353727e6e98a5e116bb45cccb2d6 (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
---
# 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
- include: docker/upgrade.yml
  vars:
    # We will restart Docker ourselves after everything is ready:
    skip_docker_restart: True
  when: l_docker_upgrade is defined and l_docker_upgrade | bool and not openshift.common.is_atomic | bool

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

- include: rpm_upgrade.yml
  vars:
    component: "node"
    openshift_version: "{{ openshift_pkg_version | default('') }}"
  when: not openshift.common.is_containerized | bool

- name: Remove obsolete docker-sdn-ovs.conf
  file: path=/etc/systemd/system/docker.service.d/docker-sdn-ovs.conf state=absent
  when: (deployment_type == 'openshift-enterprise' and openshift_release | version_compare('3.4', '>=')) or (deployment_type == 'origin' and openshift_release | version_compare('1.4', '>='))

- include: containerized_node_upgrade.yml
  when: openshift.common.is_containerized | bool

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

- name: Upgrade openvswitch
  package:
    name: openvswitch
    state: latest
  register: ovs_pkg
  when: not openshift.common.is_containerized | bool

- name: Restart openvswitch
  systemd:
    name: openvswitch
    state: restarted
  when:
  - not openshift.common.is_containerized | bool
  - ovs_pkg | changed

# Mandatory Docker restart, ensure all containerized services are running:
- include: docker/restart.yml

- name: Restart rpm node service
  service: name="{{ openshift.common.service_type }}-node" state=restarted
  when: not openshift.common.is_containerized | bool

- name: Wait for node to be ready
  command: >
    {{ hostvars[groups.oo_first_master.0].openshift.common.client_binary }} get node {{ openshift.common.hostname | lower }} --no-headers
  register: node_output
  delegate_to: "{{ groups.oo_first_master.0 }}"
  until: "{{ node_output.stdout.split()[1].startswith('Ready')}}"
  # Give the node two minutes to come back online. Note that we pre-pull images now
  # so containerized services should restart quickly as well.
  retries: 24
  delay: 5