validate.yml 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. ---
  2. # Validate configuration parameters passed to the openshift_management role
  3. ######################################################################
  4. # BETA ACKNOWLEDGEMENT
  5. - name: Ensure BETA software notice has been acknowledged
  6. assert:
  7. that:
  8. - openshift_management_install_beta | default(false) | bool
  9. msg: |
  10. openshift-management (CFME/MIQ) is currently BETA status. You
  11. must set openshift_management_install_beta to true to
  12. acknowledge that you accept this risk and understand that
  13. support is limited or nonexistent.
  14. when:
  15. - openshift_deployment_type == 'openshift-enterprise'
  16. ######################################################################
  17. # CORE PARAMETERS
  18. - name: Ensure openshift_management_app_template is valid
  19. assert:
  20. that:
  21. - openshift_management_app_template in __openshift_management_app_templates
  22. msg: |
  23. "openshift_management_app_template must be one of {{
  24. __openshift_management_app_templates | join(', ') }}"
  25. - name: Ensure openshift_management_storage_class is a valid type
  26. assert:
  27. that:
  28. - openshift_management_storage_class in __openshift_management_storage_classes
  29. msg: |
  30. "openshift_management_storage_class must be one of {{
  31. __openshift_management_storage_classes | join(', ') }}"
  32. ######################################################################
  33. # STORAGE PARAMS - NFS
  34. - name: Ensure external NFS storage has a valid NFS server hostname defined
  35. assert:
  36. that:
  37. - openshift_management_storage_nfs_external_hostname | default(False)
  38. msg: |
  39. The selected storage class 'nfs_external' requires a valid
  40. hostname for the openshift_management_storage_nfs_hostname parameter
  41. when:
  42. - openshift_management_storage_class == 'nfs_external'
  43. - name: Ensure local NFS storage has a valid NFS server to use
  44. fail:
  45. msg: |
  46. No NFS hosts detected or defined but storage class is set to
  47. 'nfs'. Add hosts to your [nfs] group or define one manually with
  48. the 'openshift_management_storage_nfs_local_hostname' parameter
  49. when:
  50. - openshift_management_storage_class == 'nfs'
  51. # You haven't created any NFS groups
  52. - (groups.nfs is defined and groups.nfs | length == 0) or (groups.nfs is not defined)
  53. # You did not manually specify a host to use
  54. - (openshift_management_storage_nfs_local_hostname is not defined) or (openshift_management_storage_nfs_local_hostname == false)
  55. ######################################################################
  56. # STORAGE PARAMS -CLOUD PROVIDER
  57. - name: Validate Cloud Provider storage class
  58. assert:
  59. that:
  60. - openshift_cloudprovider_kind == 'aws' or openshift_cloudprovider_kind == 'gce'
  61. msg: |
  62. openshift_management_storage_class is 'cloudprovider' but you have an
  63. invalid kind defined, '{{ openshift_cloudprovider_kind }}'. See
  64. 'openshift_cloudprovider_kind' in the example inventories for
  65. the required parameters for your selected cloud
  66. provider. Working providers: 'aws' and 'gce'.
  67. when:
  68. - openshift_management_storage_class == 'cloudprovider'
  69. - openshift_cloudprovider_kind is defined
  70. - name: Validate 'cloudprovider' Storage Class has required parameters defined
  71. assert:
  72. that:
  73. - openshift_cloudprovider_kind is defined
  74. msg: |
  75. openshift_management_storage_class is 'cloudprovider' but you do not
  76. have 'openshift_cloudprovider_kind' defined, this is
  77. required. Search the example inventories for
  78. 'openshift_cloudprovider_kind'. The required parameters for your
  79. selected cloud provider must be defined in your inventory as
  80. well. Working providers: 'aws' and 'gce'.
  81. when:
  82. - openshift_management_storage_class == 'cloudprovider'
  83. ######################################################################
  84. # DATABASE CONNECTION VALIDATION
  85. - name: Validate all required database parameters were provided for ext-db template
  86. assert:
  87. that:
  88. - item in openshift_management_template_parameters
  89. msg: |
  90. "You are using external database services but a required
  91. database parameter {{ item }} was not found in
  92. 'openshift_management_template_parameters'"
  93. with_items: "{{ __openshift_management_required_db_conn_params }}"
  94. when:
  95. - openshift_management_app_template in ['miq-template-ext-db', 'cfme-template-ext-db']