Преглед изворни кода

Add notes about SA token. Improve NFS validation.

Tim Bielawa пре 7 година
родитељ
комит
99811e05a2

Разлика између датотеке није приказан због своје велике величине
+ 47 - 21
roles/openshift_cfme/README.md


+ 0 - 7
roles/openshift_cfme/defaults/main.yml

@@ -76,13 +76,6 @@ openshift_cfme_storage_nfs_base_dir: /exports
 # setting this variable. Useful for testing specific task files.
 openshift_cfme_storage_nfs_local_hostname: false
 
-#---------------------------------------------------------------------
-# DEFAULT PV SIZES
-# How large to make the MIQ application PV
-openshift_cfme_app_pv_size: 5Gi
-# How large to make the MIQ PostgreSQL PV
-openshift_cfme_db_pv_size: 15Gi
-
 ######################################################################
 # SCAFFOLDING - These are parameters we pre-seed that a user may or
 # may not set later

+ 26 - 0
roles/openshift_cfme/tasks/storage/create_nfs_pvs.yml

@@ -1,5 +1,31 @@
 ---
 # Create the required PVs for the App and the DB
+- name: Note the App PV Size from Template Parameters
+  set_fact:
+    openshift_cfme_app_pv_size: "{{ openshift_cfme_template_parameters.APPLICATION_VOLUME_CAPACITY }}"
+  when:
+    - openshift_cfme_template_parameters.APPLICATION_VOLUME_CAPACITY is defined
+
+- name: Note the App PV Size from defaults
+  set_fact:
+    openshift_cfme_app_pv_size: "{{ __openshift_cfme_app_pv_size }}"
+  when:
+    - openshift_cfme_template_parameters.APPLICATION_VOLUME_CAPACITY is not defined
+
+- when: openshift_cfme_app_template in ['miq-template', 'cfme-template']
+  block:
+  - name: Note the DB PV Size from Template Parameters
+    set_fact:
+      openshift_cfme_db_pv_size: "{{ openshift_cfme_template_parameters.DATABASE_VOLUME_CAPACITY }}"
+    when:
+      - openshift_cfme_template_parameters.DATABASE_VOLUME_CAPACITY is defined
+
+  - name: Note the DB PV Size from defaults
+    set_fact:
+      openshift_cfme_db_pv_size: "{{ __openshift_cfme_db_pv_size }}"
+    when:
+      - openshift_cfme_template_parameters.DATABASE_VOLUME_CAPACITY is not defined
+
 - name: Check if the CFME App PV has been created
   oc_obj:
     namespace: "{{ openshift_cfme_project }}"

+ 27 - 9
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 }}"

+ 7 - 0
roles/openshift_cfme/vars/main.yml

@@ -8,6 +8,13 @@ __openshift_cfme_storage_classes:
   - preconfigured
   - cloudprovider
 
+#---------------------------------------------------------------------
+# DEFAULT PV SIZES
+# How large to make the MIQ application PV
+__openshift_cfme_app_pv_size: 5Gi
+# How large to make the MIQ PostgreSQL PV
+__openshift_cfme_db_pv_size: 15Gi
+
 # Name of the application templates with object/parameter definitions
 __openshift_cfme_app_templates:
   - miq-template-ext-db