summaryrefslogtreecommitdiffstats
path: root/playbooks/adhoc/preflight/check.yml
blob: b66c1a8246da27030cf74fd960165d6bde6ff856 (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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
---
- hosts: OSEv3
  gather_facts: no
  tasks:
    - set_fact:
        deployment_type: "{{ deployment_type | default('openshift-enterprise') }}"
        containerized: "{{ containerized | default('no') | bool }}"
        openshift_release: "{{ openshift_release | default('3.3') }}"
        oo_preflight_check_results: "{{ oo_preflight_check_results | default([]) }}"

- hosts: OSEv3
  name: check content available on all hosts
  gather_facts: no
  ignore_errors: yes
  tasks:
    - when:
        - not containerized
      block:

        - name: determine if yum update will work
          action: check_yum_update
          register: r

        - set_fact:
            oo_preflight_check_results: "{{ oo_preflight_check_results + [r|combine({'_task': 'check content available on all hosts'})] }}"

        - name: determine if expected version matches what is available
          aos_version:
            version: "{{ openshift_release }}"
          when:
            - deployment_type == "openshift-enterprise"
          register: r

        - set_fact:
            oo_preflight_check_results: "{{ oo_preflight_check_results + [r|combine({'_task': 'determine if expected version matches what is available'})] }}"

- hosts: masters
  name: determine if yum install of master pkgs will work
  gather_facts: no
  ignore_errors: yes
  tasks:
    - when:
        - not containerized
      block:

        - name: main packages for enterprise
          when:
            - deployment_type == "openshift-enterprise"
          check_yum_update:
            packages:
              - atomic-openshift
              - atomic-openshift-clients
              - atomic-openshift-master
          register: r

        - set_fact:
            oo_preflight_check_results: "{{ oo_preflight_check_results + [r|combine({'_task': 'main packages for enterprise'})] }}"

        - name: main packages for origin
          when:
            - deployment_type == "origin"
          check_yum_update:
            packages:
              - origin
              - origin-clients
              - origin-master
          register: r

        - set_fact:
            oo_preflight_check_results: "{{ oo_preflight_check_results + [r|combine({'_task': 'main packages for origin'})] }}"

        - name: other master packages
          check_yum_update:
            packages:
              - etcd
              - bash-completion
              - cockpit-bridge
              - cockpit-docker
              - cockpit-kubernetes
              - cockpit-shell
              - cockpit-ws
              - httpd-tools
          register: r

        - set_fact:
            oo_preflight_check_results: "{{ oo_preflight_check_results + [r|combine({'_task': 'other master packages'})] }}"

- hosts: nodes
  name: determine if yum install of node pkgs will work
  gather_facts: no
  ignore_errors: yes
  tasks:
    - when:
        - not containerized
      block:

        - name: main packages for enterprise
          when:
            - deployment_type == "openshift-enterprise"
          check_yum_update:
            packages:
              - atomic-openshift
              - atomic-openshift-node
              - atomic-openshift-sdn-ovs
          register: r

        - set_fact:
            oo_preflight_check_results: "{{ oo_preflight_check_results + [r|combine({'_task': 'main packages for enterprise'})] }}"

        - name: main packages for origin
          when:
            - deployment_type == "origin"
          check_yum_update:
            packages:
              - origin
              - origin-node
              - origin-sdn-ovs
          register: r

        - set_fact:
            oo_preflight_check_results: "{{ oo_preflight_check_results + [r|combine({'_task': 'main packages for origin'})] }}"

        - name: other node packages
          check_yum_update:
            packages:
              - docker
              - PyYAML
              - firewalld
              - iptables
              - iptables-services
              - nfs-utils
              - ntp
              - yum-utils
              - dnsmasq
              - libselinux-python
              - ceph-common
              - glusterfs-fuse
              - iscsi-initiator-utils
              - pyparted
              - python-httplib2
              - openssl
              - flannel
              - bind
          register: r

        - set_fact:
            oo_preflight_check_results: "{{ oo_preflight_check_results + [r|combine({'_task': 'other node packages'})] }}"

- hosts: OSEv3
  name: verify check results
  gather_facts: no
  tasks:

    - set_fact:
        oo_preflight_check_failures: "{{ oo_preflight_check_results | select('failed', 'equalto', True) | list }}"

    - name: ensure all checks succeed
      action: fail
      when: oo_preflight_check_failures