---
openshift_client_binary: "{{ (openshift_is_atomic | bool) | ternary('/usr/local/bin/oc', 'oc') }}"

system_images_registry_dict:
  openshift-enterprise: "registry.redhat.io"
  origin: "docker.io"
system_images_registry: "{{ system_images_registry_dict[openshift_deployment_type | default('origin')] }}"

l_openshift_images_dict:
  origin: 'docker.io/openshift/origin-${component}:${version}'
  openshift-enterprise: 'registry.redhat.io/openshift3/ose-${component}:${version}'

l_osm_registry_url_default: "{{ l_openshift_images_dict[openshift_deployment_type] }}"
l_oreg_host_temp: "{{ oreg_url | default(l_osm_registry_url_default) }}"
# oreg_url is defined by user input.
oreg_host: "{{ l_oreg_host_temp.split('/')[0] }}"

l_osm_registry_url: "{{ oreg_url | default(l_osm_registry_url_default) | regex_replace('${version}' | regex_escape, openshift_image_tag | default('${version}')) }}"
l_os_registry_url: "{{ oreg_url | default(l_osm_registry_url_default) | regex_replace('${version}' | regex_escape, openshift_image_tag | default('${version}')) }}"
openshift_image_default: "{{ l_os_registry_url | regex_replace('${component}' | regex_escape, 'node') }}"
# not sure why this one is more complicated than other images
openshift_cli_image: "{{ (system_images_registry == 'docker') | ternary(openshift_image_default, (openshift_image_default.split('/')|length==2) | ternary(system_images_registry + '/' + openshift_image_default, openshift_image_default)) }}"
system_openshift_cli_image: "{{ (system_images_registry == 'docker') | ternary('docker:' + openshift_cli_image, openshift_cli_image) }}"
osn_image: "{{ l_os_registry_url | regex_replace('${component}' | regex_escape, 'node') }}"
osm_image: "{{ l_osm_registry_url | regex_replace('${component}' | regex_escape, 'control-plane') }}"

repoquery_cmd: "{{ (ansible_pkg_mgr == 'dnf') | ternary('dnf repoquery --latest-limit 1 -d 0', 'repoquery --plugins') }}"
repoquery_installed: "{{ (ansible_pkg_mgr == 'dnf') | ternary('dnf repoquery --latest-limit 1 -d 0 --disableexcludes=all --installed', 'repoquery --plugins --installed') }}"

openshift_use_crio_only: False

# osm_default_subdomain is an old migrated fact, can probably be removed.
osm_default_subdomain: "router.default.svc.cluster.local"
openshift_master_default_subdomain: "{{ osm_default_subdomain }}"

openshift_portal_net: "{{ openshift_master_portal_net | default(None) }}"
openshift_cluster_network_cidr: "{{ osm_cluster_network_cidr | default('10.128.0.0/14') }}"
openshift_host_subnet_length: "{{ osm_host_subnet_length | default('9') }}"

openshift_hosted_etcd_storage_nfs_directory: '/exports'
openshift_hosted_etcd_storage_nfs_options: '*(rw,root_squash)'
openshift_hosted_etcd_storage_volume_name: 'etcd'
openshift_hosted_etcd_storage_volume_size: '1Gi'
openshift_hosted_etcd_storage_create_pv: True
openshift_hosted_etcd_storage_create_pvc: False
openshift_hosted_etcd_storage_access_modes:
  - 'ReadWriteOnce'

openshift_hosted_registry_namespace: 'default'
openshift_hosted_registry_storage_volume_name: 'registry'
openshift_hosted_registry_storage_volume_size: '5Gi'
openshift_hosted_registry_storage_create_pv: True
openshift_hosted_registry_storage_create_pvc: True
openshift_hosted_registry_storage_nfs_directory: '/exports'
openshift_hosted_registry_storage_nfs_options: '*(rw,root_squash)'
openshift_hosted_registry_storage_glusterfs_endpoints: 'glusterfs-registry-endpoints'
openshift_hosted_registry_storage_glusterfs_path: glusterfs-registry-volume
openshift_hosted_registry_storage_glusterfs_readOnly: False
openshift_hosted_registry_storage_glusterfs_swap: False
openshift_hosted_registry_storage_glusterfs_swapcopy: True
openshift_hosted_registry_storage_glusterfs_ips: []
openshift_hosted_registry_storage_hostpath_path: /var/lib/openshift_volumes
# Default to ReadWriteOnce if using hostpath, else default to ReadWriteMany
openshift_hosted_registry_storage_access_modes:
  - "{{ (openshift_hosted_registry_storage_kind == 'hostpath') | ternary('ReadWriteOnce', 'ReadWriteMany') }}"

openshift_logging_storage_nfs_directory: '/exports'
openshift_logging_storage_nfs_options: '*(rw,root_squash)'
openshift_logging_storage_volume_name: 'logging-es'
openshift_logging_storage_create_pv: True
openshift_logging_storage_create_pvc: False
openshift_logging_storage_access_modes:
  - ['ReadWriteOnce']

openshift_loggingops_storage_volume_name: 'logging-es-ops'
openshift_loggingops_storage_volume_size: '10Gi'
openshift_loggingops_storage_create_pv: True
openshift_loggingops_storage_create_pvc: False
openshift_loggingops_storage_nfs_directory: '/exports'
openshift_loggingops_storage_nfs_options: '*(rw,root_squash)'
openshift_loggingops_storage_access_modes:
  - 'ReadWriteOnce'

openshift_metrics_deploy: False
openshift_metrics_duration: 7
openshift_metrics_resolution: '10s'
openshift_metrics_storage_volume_name: 'metrics'
openshift_metrics_storage_volume_size: '10Gi'
openshift_metrics_storage_create_pv: True
openshift_metrics_storage_create_pvc: False
openshift_metrics_storage_nfs_directory: '/exports'
openshift_metrics_storage_nfs_options: '*(rw,root_squash)'
openshift_metrics_storage_access_modes:
  - 'ReadWriteOnce'

openshift_prometheus_storage_volume_name: 'prometheus'
openshift_prometheus_storage_volume_size: '10Gi'
openshift_prometheus_storage_access_modes:
  - 'ReadWriteOnce'
openshift_prometheus_storage_create_pv: True
openshift_prometheus_storage_create_pvc: False

openshift_prometheus_alertmanager_storage_volume_name: 'prometheus-alertmanager'
openshift_prometheus_alertmanager_storage_volume_size: '10Gi'
openshift_prometheus_alertmanager_storage_access_modes:
  - 'ReadWriteOnce'
openshift_prometheus_alertmanager_storage_create_pv: True
openshift_prometheus_alertmanager_storage_create_pvc: False

openshift_prometheus_alertbuffer_storage_volume_name: 'prometheus-alertbuffer'
openshift_prometheus_alertbuffer_storage_volume_size: '10Gi'
openshift_prometheus_alertbuffer_storage_access_modes:
  - 'ReadWriteOnce'
openshift_prometheus_alertbuffer_storage_create_pv: True
openshift_prometheus_alertbuffer_storage_create_pvc: False

openshift_service_type_dict:
  origin: origin
  openshift-enterprise: atomic-openshift

openshift_service_type: "{{ openshift_service_type_dict[openshift_deployment_type] }}"
openshift_master_api_port: "8443"
openshift_ca_host: "{{ groups.oo_first_master.0 }}"
openshift_use_openshift_sdn: true
os_sdn_network_plugin_name: "redhat/openshift-ovs-subnet"

openshift_node_groups:
  - name: node-config-master
    labels:
      - 'node-role.kubernetes.io/master=true'
    edits: []
  - name: node-config-infra
    labels:
      - 'node-role.kubernetes.io/infra=true'
    edits: []
  - name: node-config-compute
    labels:
      - 'node-role.kubernetes.io/compute=true'
    edits: []
  - name: node-config-master-infra
    labels:
      - 'node-role.kubernetes.io/infra=true,node-role.kubernetes.io/master=true'
    edits: []
  - name: node-config-all-in-one
    labels:
      - 'node-role.kubernetes.io/infra=true,node-role.kubernetes.io/master=true,node-role.kubernetes.io/compute=true'
    edits: []
openshift_master_manage_htpasswd: True
