summaryrefslogtreecommitdiffstats
path: root/roles/openshift_node/tasks/upgrade_pre.yml
blob: 3ae7dc6b656eab61ee066ba365f8beffe9bce1e6 (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
---
# This is a hack to allow us to update various components without restarting
# services.  This will persist into the upgrade play as well, so everything
# needs to be restarted by hand.
- set_fact:
    skip_node_svc_handlers: True

- include_tasks: registry_auth.yml

- name: update package meta data to speed install later.
  command: "{{ ansible_pkg_mgr }} makecache"
  register: result
  until: result is succeeded
  when: not openshift_is_containerized | bool

- name: Check Docker image count
  shell: "docker images -aq | wc -l"
  register: docker_image_count
  when:
  - l_docker_upgrade is defined
  - l_docker_upgrade | bool

- debug: var=docker_image_count.stdout
  when:
  - l_docker_upgrade is defined
  - l_docker_upgrade | bool

- include_tasks: upgrade/containerized_upgrade_pull.yml
  when: openshift_is_containerized | bool

# Prepull the rpms for docker upgrade, but don't install
- name: download docker upgrade rpm
  command: "{{ ansible_pkg_mgr }} install -y --downloadonly docker{{ '-' + docker_version }}"
  register: result
  until: result is succeeded
  when:
  - l_docker_upgrade is defined
  - l_docker_upgrade | bool

- include_tasks: upgrade/rpm_upgrade.yml
  vars:
    openshift_version: "{{ openshift_pkg_version | default('') }}"
  when: not openshift_is_containerized | bool

# https://docs.openshift.com/container-platform/3.4/admin_guide/overcommit.html#disabling-swap-memory
- name: Check for swap usage
  command: grep "^[^#].*swap" /etc/fstab
  # grep: match any lines which don't begin with '#' and contain 'swap'
  changed_when: false
  failed_when: false
  register: swap_result

# Set this fact here so we can use it during the next play, which is serial.
- name: set_fact swap_result
  set_fact:
    openshift_node_upgrade_swap_result: "{{ swap_result.stdout_lines | length > 0 | bool }}"