summaryrefslogtreecommitdiffstats
path: root/roles/openshift_management/tasks/validate.yml
blob: 2dc895190c2da7af401c24f17fec41a729e85d66 (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
---
# Validate configuration parameters passed to the openshift_management role

######################################################################
# BETA ACKNOWLEDGEMENT
- name: Ensure BETA software notice has been acknowledged
  assert:
    that:
      - openshift_management_install_beta | default(false) | bool
    msg: |
      openshift-management (CFME/MIQ) is currently BETA status. You
      must set openshift_management_install_beta to true to
      acknowledge that you accept this risk and understand that
      support is limited or nonexistent.
  when:
    - openshift_deployment_type == 'openshift-enterprise'

######################################################################
# CORE PARAMETERS
- name: Ensure openshift_management_app_template is valid
  assert:
    that:
      - openshift_management_app_template in __openshift_management_app_templates
    msg: |
      "openshift_management_app_template must be one of {{
      __openshift_management_app_templates | join(', ') }}"

- name: Ensure openshift_management_storage_class is a valid type
  assert:
    that:
      - openshift_management_storage_class in __openshift_management_storage_classes
    msg: |
      "openshift_management_storage_class must be one of {{
      __openshift_management_storage_classes | join(', ') }}"

######################################################################
# STORAGE PARAMS - NFS
- name: Ensure external NFS storage has a valid NFS server hostname defined
  assert:
    that:
      - openshift_management_storage_nfs_external_hostname | default(False)
    msg: |
      The selected storage class 'nfs_external' requires a valid
      hostname for the openshift_management_storage_nfs_hostname parameter
  when:
    - openshift_management_storage_class == 'nfs_external'

- name: Ensure local NFS storage has a valid NFS server to use
  fail:
    msg: |
      No NFS hosts detected or defined but storage class is set to
      'nfs'. Add hosts to your [nfs] group or define one manually with
      the 'openshift_management_storage_nfs_local_hostname' parameter
  when:
    - openshift_management_storage_class == 'nfs'
    # You haven't created any NFS groups
    - (groups.nfs is defined and groups.nfs | length == 0) or (groups.nfs is not defined)
    # You did not manually specify a host to use
    - (openshift_management_storage_nfs_local_hostname is not defined) or (openshift_management_storage_nfs_local_hostname == false)

######################################################################
# STORAGE PARAMS  -CLOUD PROVIDER
- name: Validate Cloud Provider storage class
  assert:
    that:
      - openshift_cloudprovider_kind == 'aws' or openshift_cloudprovider_kind == 'gce'
    msg: |
      openshift_management_storage_class is 'cloudprovider' but you have an
      invalid kind defined, '{{ openshift_cloudprovider_kind }}'. See
      'openshift_cloudprovider_kind' in the example inventories for
      the required parameters for your selected cloud
      provider. Working providers: 'aws' and 'gce'.
  when:
    - openshift_management_storage_class == 'cloudprovider'
    - openshift_cloudprovider_kind is defined

- name: Validate 'cloudprovider' Storage Class has required parameters defined
  assert:
    that:
      - openshift_cloudprovider_kind is defined
    msg: |
      openshift_management_storage_class is 'cloudprovider' but you do not
      have 'openshift_cloudprovider_kind' defined, this is
      required. Search the example inventories for
      'openshift_cloudprovider_kind'. The required parameters for your
      selected cloud provider must be defined in your inventory as
      well. Working providers: 'aws' and 'gce'.
  when:
    - openshift_management_storage_class == 'cloudprovider'

######################################################################
# DATABASE CONNECTION VALIDATION
- name: Validate all required database parameters were provided for ext-db template
  assert:
    that:
      - item in openshift_management_template_parameters
    msg: |
      "You are using external database services but a required
      database parameter {{ item }} was not found in
      'openshift_management_template_parameters'"
  with_items: "{{ __openshift_management_required_db_conn_params }}"
  when:
    - __openshift_management_use_ext_db