summaryrefslogtreecommitdiffstats
path: root/roles/openshift_master/tasks/system_container.yml
blob: a0e1ac75e8e770c8e502dae8967bed989cb8a29f (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
---
- name: Pre-pull master system container image
  command: >
    atomic pull --storage=ostree {{ openshift.common.system_images_registry }}/{{ openshift.master.master_system_image }}:{{ openshift_image_tag }}
  register: pull_result
  changed_when: "'Pulling layer' in pull_result.stdout"

- name: Check Master system container package
  command: >
    atomic containers list --no-trunc -a -f container={{ openshift.common.service_type }}-master
  register: result

- name: Update Master system container package
  command: >
    atomic containers update {{ openshift.common.service_type }}-master
  register: update_result
  changed_when: "'Extracting' in update_result.stdout"
  when:
    - ("master" in result.stdout)
    - l_is_same_version
    - not l_is_ha

- name: Uninstall Master system container package
  command: >
    atomic uninstall {{ openshift.common.service_type }}-master
  failed_when: False
  when:
    - ("master" in result.stdout)
    - not l_is_same_version
    - not l_is_ha

- name: Install Master system container package
  command: >
    atomic install --system --name={{ openshift.common.service_type }}-master {{ openshift.common.system_images_registry }}/{{ openshift.master.master_system_image }}:{{ openshift_image_tag }}
  when:
    - not l_is_same_version or ("master" not in result.stdout) | bool
    - not l_is_ha
  notify:
    - restart master

# HA
- name: Update Master HA system container package
  command: >
    atomic containers update {{ openshift.common.service_type }}-master-{{ item }}
  register: update_result
  changed_when: "'Extracting' in update_result.stdout"
  with_items:
    - api
    - controllers
  when:
    - ("master" in result.stdout)
    - l_is_same_version
    - l_is_ha

- name: Uninstall Master HA system container package
  command: >
    atomic uninstall {{ openshift.common.service_type }}-master-{{ item }}
  failed_when: False
  with_items:
    - api
    - controllers
  when:
    - ("master" in result.stdout)
    - not l_is_same_version
    - l_is_ha

- name: Install Master HA system container package
  command: >
    atomic install --system --set COMMAND={{ item }} --name={{ openshift.common.service_type }}-master-{{ item }} {{ openshift.common.system_images_registry }}/{{ openshift.master.master_system_image }}:{{ openshift_image_tag }}
  with_items:
    - api
    - controllers
  when:
    - not l_is_same_version or ("master" not in result.stdout) | bool
    - l_is_ha
  notify:
    - restart master