summaryrefslogtreecommitdiffstats
path: root/roles/openshift_sanitize_inventory
diff options
context:
space:
mode:
Diffstat (limited to 'roles/openshift_sanitize_inventory')
-rw-r--r--roles/openshift_sanitize_inventory/filter_plugins/openshift_logging.py25
-rw-r--r--roles/openshift_sanitize_inventory/filter_plugins/openshift_sanitize_inventory.py44
-rw-r--r--roles/openshift_sanitize_inventory/tasks/__deprecations_logging.yml12
-rw-r--r--roles/openshift_sanitize_inventory/tasks/main.yml35
-rw-r--r--roles/openshift_sanitize_inventory/tasks/unsupported.yml30
5 files changed, 114 insertions, 32 deletions
diff --git a/roles/openshift_sanitize_inventory/filter_plugins/openshift_logging.py b/roles/openshift_sanitize_inventory/filter_plugins/openshift_logging.py
deleted file mode 100644
index d42c9bdb9..000000000
--- a/roles/openshift_sanitize_inventory/filter_plugins/openshift_logging.py
+++ /dev/null
@@ -1,25 +0,0 @@
-'''
- Openshift Logging class that provides useful filters used in Logging.
-
- This should be removed after map_from_pairs is no longer used in __deprecations_logging.yml
-'''
-
-
-def map_from_pairs(source, delim="="):
- ''' Returns a dict given the source and delim delimited '''
- if source == '':
- return dict()
-
- return dict(item.split(delim) for item in source.split(","))
-
-
-# pylint: disable=too-few-public-methods
-class FilterModule(object):
- ''' OpenShift Logging Filters '''
-
- # pylint: disable=no-self-use, too-few-public-methods
- def filters(self):
- ''' Returns the names of the filters provided by this class '''
- return {
- 'map_from_pairs': map_from_pairs
- }
diff --git a/roles/openshift_sanitize_inventory/filter_plugins/openshift_sanitize_inventory.py b/roles/openshift_sanitize_inventory/filter_plugins/openshift_sanitize_inventory.py
new file mode 100644
index 000000000..72c47b8ee
--- /dev/null
+++ b/roles/openshift_sanitize_inventory/filter_plugins/openshift_sanitize_inventory.py
@@ -0,0 +1,44 @@
+'''
+ Openshift Sanitize inventory class that provides useful filters used in Logging.
+'''
+
+
+import re
+
+
+# This should be removed after map_from_pairs is no longer used in __deprecations_logging.yml
+def map_from_pairs(source, delim="="):
+ ''' Returns a dict given the source and delim delimited '''
+ if source == '':
+ return dict()
+
+ return dict(item.split(delim) for item in source.split(","))
+
+
+def vars_with_pattern(source, pattern=""):
+ ''' Returns a list of variables whose name matches the given pattern '''
+ if source == '':
+ return list()
+
+ var_list = list()
+
+ var_pattern = re.compile(pattern)
+
+ for item in source:
+ if var_pattern.match(item):
+ var_list.append(item)
+
+ return var_list
+
+
+# pylint: disable=too-few-public-methods
+class FilterModule(object):
+ ''' OpenShift Logging Filters '''
+
+ # pylint: disable=no-self-use, too-few-public-methods
+ def filters(self):
+ ''' Returns the names of the filters provided by this class '''
+ return {
+ 'map_from_pairs': map_from_pairs,
+ 'vars_with_pattern': vars_with_pattern
+ }
diff --git a/roles/openshift_sanitize_inventory/tasks/__deprecations_logging.yml b/roles/openshift_sanitize_inventory/tasks/__deprecations_logging.yml
index e534e0cca..7c1573096 100644
--- a/roles/openshift_sanitize_inventory/tasks/__deprecations_logging.yml
+++ b/roles/openshift_sanitize_inventory/tasks/__deprecations_logging.yml
@@ -21,16 +21,22 @@
openshift_logging_image_pull_secret: openshift_hosted_logging_image_pull_secret
openshift_logging_kibana_hostname: openshift_hosted_logging_hostname
openshift_logging_kibana_ops_hostname: openshift_hosted_logging_ops_hostname
+ openshift_logging_kibana_nodeselector: openshift_hosted_logging_kibana_nodeselector
+ openshift_logging_kibana_ops_nodeselector: openshift_hosted_logging_kibana_ops_nodeselector
openshift_logging_fluentd_journal_source: openshift_hosted_logging_journal_source
openshift_logging_fluentd_journal_read_from_head: openshift_hosted_logging_journal_read_from_head
+ openshift_logging_fluentd_nodeselector: openshift_hosted_logging_fluentd_nodeselector_label
openshift_logging_es_memory_limit: openshift_hosted_logging_elasticsearch_instance_ram
openshift_logging_es_nodeselector: openshift_hosted_logging_elasticsearch_nodeselector
+ openshift_logging_es_ops_nodeselector: openshift_hosted_logging_elasticsearch_ops_nodeselector
openshift_logging_es_ops_memory_limit: openshift_hosted_logging_elasticsearch_ops_instance_ram
openshift_logging_storage_access_modes: openshift_hosted_logging_storage_access_modes
openshift_logging_master_public_url: openshift_hosted_logging_master_public_url
openshift_logging_image_prefix: openshift_hosted_logging_deployer_prefix
openshift_logging_image_version: openshift_hosted_logging_deployer_version
openshift_logging_install_logging: openshift_hosted_logging_deploy
+ openshift_logging_curator_nodeselector: openshift_hosted_logging_curator_nodeselector
+ openshift_logging_curator_ops_nodeselector: openshift_hosted_logging_curator_ops_nodeselector
- set_fact:
@@ -40,9 +46,3 @@
openshift_logging_elasticsearch_ops_pvc_dynamic: "{{ 'true' if openshift_loggingops_storage_kind | default(none) == 'dynamic' else '' }}"
openshift_logging_elasticsearch_ops_pvc_size: "{{ openshift_loggingops_storage_volume_size | default('10Gi') if openshift_loggingops_storage_kind | default(none) in ['dynamic','nfs'] else '' }}"
openshift_logging_elasticsearch_ops_pvc_prefix: "{{ 'logging-es-ops' if openshift_loggingops_storage_kind | default(none) == 'dynamic' else '' }}"
- openshift_logging_curator_nodeselector: "{{ openshift_hosted_logging_curator_nodeselector | default('') | map_from_pairs }}"
- openshift_logging_curator_ops_nodeselector: "{{ openshift_hosted_logging_curator_ops_nodeselector | default('') | map_from_pairs }}"
- openshift_logging_kibana_nodeselector: "{{ openshift_hosted_logging_kibana_nodeselector | default('') | map_from_pairs }}"
- openshift_logging_kibana_ops_nodeselector: "{{ openshift_hosted_logging_kibana_ops_nodeselector | default('') | map_from_pairs }}"
- openshift_logging_fluentd_nodeselector: "{{ openshift_hosted_logging_fluentd_nodeselector_label | default('logging-infra-fluentd=true') | map_from_pairs }}"
- openshift_logging_es_ops_nodeselector: "{{ openshift_hosted_logging_elasticsearch_ops_nodeselector | default('') | map_from_pairs }}"
diff --git a/roles/openshift_sanitize_inventory/tasks/main.yml b/roles/openshift_sanitize_inventory/tasks/main.yml
index e327ee9f5..70b236033 100644
--- a/roles/openshift_sanitize_inventory/tasks/main.yml
+++ b/roles/openshift_sanitize_inventory/tasks/main.yml
@@ -23,6 +23,8 @@
# TODO: once this is well-documented, add deprecation notice if using old name.
deployment_type: "{{ openshift_deployment_type | default(deployment_type) | default | string }}"
openshift_deployment_type: "{{ openshift_deployment_type | default(deployment_type) | default | string }}"
+ deployment_subtype: "{{ openshift_deployment_subtype | default(deployment_subtype) | default('basic') | string }}"
+ openshift_deployment_subtype: "{{ openshift_deployment_subtype | default(deployment_subtype) | default('basic') | string }}"
- name: Abort when deployment type is invalid
# this variable is required; complain early and clearly if it is invalid.
@@ -45,7 +47,7 @@
- name: Abort when openshift_release is invalid
when:
- openshift_release is defined
- - not openshift_release | match('\d+(\.\d+){1,3}$')
+ - not openshift_release | match('^\d+(\.\d+){1,3}$')
fail:
msg: |-
openshift_release is "{{ openshift_release }}" which is not a valid version string.
@@ -54,3 +56,34 @@
- include: unsupported.yml
when:
- not openshift_enable_unsupported_configurations | default(false) | bool
+
+- name: Ensure clusterid is set along with the cloudprovider
+ fail:
+ msg: >
+ Ensure that the openshift_clusterid is set and that all infrastructure has the required tags.
+
+ For dynamic provisioning when using multiple clusters in different zones, tag each node with Key=kubernetes.io/cluster/xxxx,Value=clusterid where xxxx and clusterid are unique per cluster. In versions prior to 3.6, this was Key=KubernetesCluster,Value=clusterid.
+
+ https://github.com/openshift/openshift-docs/blob/master/install_config/persistent_storage/dynamically_provisioning_pvs.adoc#available-dynamically-provisioned-plug-ins
+ when:
+ - openshift_clusterid is not defined
+ - openshift_cloudprovider_kind is defined
+ - openshift_cloudprovider_kind == 'aws'
+
+- name: Ensure ansible_service_broker_remove and ansible_service_broker_install are mutually exclusive
+ fail:
+ msg: >
+ Ensure ansible_service_broker_remove and ansible_service_broker_install are mutually exclusive,
+ do not set both to true. ansible_service_broker_install defaults to true.
+ when:
+ - ansible_service_broker_remove | default(false) | bool
+ - ansible_service_broker_install | default(true) | bool
+
+- name: Ensure template_service_broker_remove and template_service_broker_install are mutually exclusive
+ fail:
+ msg: >
+ Ensure that template_service_broker_remove and template_service_broker_install are mutually exclusive,
+ do not set both to true. template_service_broker_remove defaults to true.
+ when:
+ - template_service_broker_remove | default(false) | bool
+ - template_service_broker_install | default(true) | bool
diff --git a/roles/openshift_sanitize_inventory/tasks/unsupported.yml b/roles/openshift_sanitize_inventory/tasks/unsupported.yml
index 24e44ea85..b70ab90a1 100644
--- a/roles/openshift_sanitize_inventory/tasks/unsupported.yml
+++ b/roles/openshift_sanitize_inventory/tasks/unsupported.yml
@@ -10,3 +10,33 @@
Starting in 3.6 openshift_use_dnsmasq must be true or critical features
will not function. This also means that NetworkManager must be installed
enabled and responsible for management of the primary interface.
+
+- name: Ensure that openshift_node_dnsmasq_install_network_manager_hook is true
+ when:
+ - not openshift_node_dnsmasq_install_network_manager_hook | default(true) | bool
+ fail:
+ msg: |-
+ The NetworkManager hook is considered a critical part of the DNS
+ infrastructure.
+
+- set_fact:
+ __using_dynamic: True
+ when:
+ - hostvars[inventory_hostname][item] in ['dynamic']
+ with_items:
+ - "{{ hostvars[inventory_hostname] | vars_with_pattern(pattern='openshift_.*_storage_kind') }}"
+
+- name: Ensure that dynamic provisioning is set if using dynamic storage
+ when:
+ - dynamic_volumes_check | default(true) | bool
+ - not openshift_master_dynamic_provisioning_enabled | default(false) | bool
+ - not openshift_cloudprovider_kind is defined
+ - __using_dynamic is defined and __using_dynamic | bool
+ fail:
+ msg: |-
+ Using a storage kind of 'dynamic' without enabling dynamic provisioning nor
+ setting a cloud provider will cause generated PVCs to not be able to bind as
+ intended. Either update to not use a dynamic storage or set
+ openshift_master_dynamic_provisioning_enabled to True and set an
+ openshift_cloudprovider_kind. You can disable this check with
+ 'dynamic_volumes_check=False'.