summaryrefslogtreecommitdiffstats
path: root/playbooks/common/openshift-cluster/upgrades/pre/verify_control_plane_running.yml
blob: 6a5bc24f7016dce3fb2b0e92e0a0b37b96d734fd (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
---
- name: Verify master processes
  hosts: oo_masters_to_config
  roles:
  - openshift_facts
  tasks:
  - openshift_facts:
      role: master
      local_facts:
        ha: "{{ groups.oo_masters_to_config | length > 1 }}"

  - when: openshift.common.is_containerized | bool
    block:
    - set_fact:
        master_services:
        - "{{ openshift.common.service_type }}-master"

    # In case of the non-ha to ha upgrade.
    - name: Check if the {{ openshift.common.service_type }}-master-api.service exists
      command: >
        systemctl list-units {{ openshift.common.service_type }}-master-api.service --no-legend
      register: master_api_service_status

    - set_fact:
        master_services:
        - "{{ openshift.common.service_type }}-master-api"
        - "{{ openshift.common.service_type }}-master-controllers"
      when:
      - master_api_service_status.stdout_lines | length > 0
      - (openshift.common.service_type + '-master-api.service') in master_api_service_status.stdout_lines[0]

    - name: Ensure Master is running
      service:
        name: "{{ item }}"
        state: started
        enabled: yes
      with_items: "{{ master_services }}"