---
# This task list checks for unsupported configurations. Values here should yield
# a partially functioning cluster but would not be supported for production use.

- name: Ensure that openshift_use_dnsmasq is true
  when:
  - not openshift_use_dnsmasq | default(true) | bool
  fail:
    msg: |-
      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'.
