From 42d330a1cf2990fee39dab36250524ebfb303428 Mon Sep 17 00:00:00 2001 From: Tim Bielawa Date: Wed, 6 Sep 2017 15:11:55 -0400 Subject: CFME 4.6 work begins. CFME 4.5 references added to the release-3.6 branch --- roles/openshift_cfme/tasks/validate.yml | 34 +++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 roles/openshift_cfme/tasks/validate.yml (limited to 'roles/openshift_cfme/tasks/validate.yml') diff --git a/roles/openshift_cfme/tasks/validate.yml b/roles/openshift_cfme/tasks/validate.yml new file mode 100644 index 000000000..61448aa3b --- /dev/null +++ b/roles/openshift_cfme/tasks/validate.yml @@ -0,0 +1,34 @@ +--- +# Validate configuration parameters passed to the openshift_cfme role + +- name: Ensure openshift_cfme_app_template is valid + assert: + that: + - openshift_cfme_app_template in openshift_cfme_app_templates + msg: "openshift_cfme_app_template must be one of {{ openshift_cfme_app_templates | join(', ') }}" + +- name: Ensure openshift_cfme_storage_class is a valid type + assert: + that: + - openshift_cfme_storage_class in openshift_cfme_storage_classes + msg: "openshift_cfme_storage_class must be one of {{ openshift_cfme_storage_classes | join(', ') }}" + +- name: Ensure external NFS storage has a valid NFS server hostname defined + assert: + that: + - openshift_cfme_storage_external_nfs_hostname is not False + msg: The selected storage class 'external' requires a valid hostname for the openshift_cfme_storage_external_nfs_hostname parameter + when: + - openshift_cfme_storage_class == 'external' + +- name: Validate Cloud Provider storage class + assert: + that: + - openshift_cloudprovider_kind == 'aws' or openshift_cloudprovider_kind == 'gce' + msg: | + openshift_cfme_storage_class is 'cloudprovider' but you have an + invalid kind defined. See 'openshift_cloudprovider_kind' in the + example inventories for the required parameters for your + selected cloud provider. Working providers: 'aws' and 'gce'. + when: + - openshift_cloudprovider_kind is defined -- cgit v1.2.3 From 8e10c53974b4b87e483ed0dfec3946383aa071c7 Mon Sep 17 00:00:00 2001 From: Tim Bielawa Date: Fri, 15 Sep 2017 17:18:22 -0400 Subject: Import upstream templates. Do the work. Validate parameters. --- roles/openshift_cfme/tasks/validate.yml | 52 ++++++++++++++++++++++++++++----- 1 file changed, 45 insertions(+), 7 deletions(-) (limited to 'roles/openshift_cfme/tasks/validate.yml') diff --git a/roles/openshift_cfme/tasks/validate.yml b/roles/openshift_cfme/tasks/validate.yml index 61448aa3b..c7409d9ab 100644 --- a/roles/openshift_cfme/tasks/validate.yml +++ b/roles/openshift_cfme/tasks/validate.yml @@ -1,26 +1,35 @@ --- # Validate configuration parameters passed to the openshift_cfme role +###################################################################### +# CORE PARAMETERS - name: Ensure openshift_cfme_app_template is valid assert: that: - - openshift_cfme_app_template in openshift_cfme_app_templates - msg: "openshift_cfme_app_template must be one of {{ openshift_cfme_app_templates | join(', ') }}" + - openshift_cfme_app_template in __openshift_cfme_app_templates + msg: "openshift_cfme_app_template must be one of {{ __openshift_cfme_app_templates | join(', ') }}" - name: Ensure openshift_cfme_storage_class is a valid type assert: that: - - openshift_cfme_storage_class in openshift_cfme_storage_classes - msg: "openshift_cfme_storage_class must be one of {{ openshift_cfme_storage_classes | join(', ') }}" + - openshift_cfme_storage_class in __openshift_cfme_storage_classes + msg: "openshift_cfme_storage_class must be one of {{ __openshift_cfme_storage_classes | join(', ') }}" +###################################################################### +# STORAGE PARAMS - NFS - name: Ensure external NFS storage has a valid NFS server hostname defined assert: that: - - openshift_cfme_storage_external_nfs_hostname is not False - msg: The selected storage class 'external' requires a valid hostname for the openshift_cfme_storage_external_nfs_hostname parameter + - openshift_cfme_storage_nfs_external_hostname | default(False) + msg: The selected storage class 'nfs_external' requires a valid hostname for the openshift_cfme_storage_nfs_hostname parameter when: - - openshift_cfme_storage_class == 'external' + - openshift_cfme_storage_class == 'nfs_external' +# that 'nfs' types have one of the following set: +# + +###################################################################### +# STORAGE PARAMS -CLOUD PROVIDER - name: Validate Cloud Provider storage class assert: that: @@ -31,4 +40,33 @@ example inventories for the required parameters for your selected cloud provider. Working providers: 'aws' and 'gce'. when: + - openshift_cfme_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_cfme_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_cfme_storage_class == 'cloudprovider' + +###################################################################### +# DATABASE CONNECTION VALIDATION +- name: Validate all required database parameters were provided for ext-db template + assert: + that: + - item in openshift_cfme_template_parameters + msg: | + "You are not using podified database services and a required + database parameter {{ item }} was not found in + 'openshift_cfme_template_parameters'" + with_items: "{{ __openshift_cfme_required_db_conn_params }}" + when: + - openshift_cfme_app_template in ['miq-template-ext-db', 'cfme-template-ext-db'] -- cgit v1.2.3 From 99811e05a245ef23e806f5c847f72d267b142bf1 Mon Sep 17 00:00:00 2001 From: Tim Bielawa Date: Wed, 4 Oct 2017 10:06:50 -0400 Subject: Add notes about SA token. Improve NFS validation. --- roles/openshift_cfme/tasks/validate.yml | 36 ++++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 9 deletions(-) (limited to 'roles/openshift_cfme/tasks/validate.yml') diff --git a/roles/openshift_cfme/tasks/validate.yml b/roles/openshift_cfme/tasks/validate.yml index c7409d9ab..1ba813a43 100644 --- a/roles/openshift_cfme/tasks/validate.yml +++ b/roles/openshift_cfme/tasks/validate.yml @@ -7,13 +7,18 @@ assert: that: - openshift_cfme_app_template in __openshift_cfme_app_templates - msg: "openshift_cfme_app_template must be one of {{ __openshift_cfme_app_templates | join(', ') }}" + + msg: | + "openshift_cfme_app_template must be one of {{ + __openshift_cfme_app_templates | join(', ') }}" - name: Ensure openshift_cfme_storage_class is a valid type assert: that: - openshift_cfme_storage_class in __openshift_cfme_storage_classes - msg: "openshift_cfme_storage_class must be one of {{ __openshift_cfme_storage_classes | join(', ') }}" + msg: | + "openshift_cfme_storage_class must be one of {{ + __openshift_cfme_storage_classes | join(', ') }}" ###################################################################### # STORAGE PARAMS - NFS @@ -21,12 +26,24 @@ assert: that: - openshift_cfme_storage_nfs_external_hostname | default(False) - msg: The selected storage class 'nfs_external' requires a valid hostname for the openshift_cfme_storage_nfs_hostname parameter + msg: | + The selected storage class 'nfs_external' requires a valid + hostname for the openshift_cfme_storage_nfs_hostname parameter when: - openshift_cfme_storage_class == 'nfs_external' -# that 'nfs' types have one of the following set: -# +- 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_cfme_storage_nfs_local_hostname' parameter + when: + - openshift_cfme_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_cfme_storage_nfs_local_hostname is not defined) or (openshift_cfme_storage_nfs_local_hostname == false) ###################################################################### # STORAGE PARAMS -CLOUD PROVIDER @@ -36,9 +53,10 @@ - openshift_cloudprovider_kind == 'aws' or openshift_cloudprovider_kind == 'gce' msg: | openshift_cfme_storage_class is 'cloudprovider' but you have an - invalid kind defined. See 'openshift_cloudprovider_kind' in the - example inventories for the required parameters for your - selected cloud provider. Working providers: 'aws' and 'gce'. + 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_cfme_storage_class == 'cloudprovider' - openshift_cloudprovider_kind is defined @@ -64,7 +82,7 @@ that: - item in openshift_cfme_template_parameters msg: | - "You are not using podified database services and a required + "You are using external database services but a required database parameter {{ item }} was not found in 'openshift_cfme_template_parameters'" with_items: "{{ __openshift_cfme_required_db_conn_params }}" -- cgit v1.2.3