---
openshift_node_debug_level: "{{ debug_level | default(2) }}"
openshift_node_iptables_sync_period: '30s'
osn_storage_plugin_deps:
- ceph
- glusterfs
- iscsi
openshift_node_local_quota_per_fsgroup: ""
openshift_node_proxy_mode: iptables
openshift_set_node_ip: False
openshift_config_base: '/etc/origin'

openshift_oreg_url_default_dict:
  origin: "openshift/origin-${component}:${version}"
  openshift-enterprise: "openshift3/ose-${component}:${version}"
openshift_oreg_url_default: "{{ openshift_oreg_url_default_dict[openshift_deployment_type] }}"
oreg_url_node: "{{ oreg_url | default(openshift_oreg_url_default) }}"

osn_ovs_image_default_dict:
  origin: "openshift/openvswitch"
  openshift-enterprise: "openshift3/openvswitch"
osn_ovs_image_default: "{{ osn_ovs_image_default_dict[openshift_deployment_type] }}"
osn_ovs_image: "{{ osn_ovs_image_default }}"

openshift_dns_ip: "{{ ansible_default_ipv4['address'] }}"

openshift_node_env_vars: {}

# Create list of 'k=v' pairs.
l_node_kubelet_node_labels: "{{ openshift_node_labels | default({}) | lib_utils_oo_dict_to_keqv_list }}"

openshift_node_kubelet_args_dict:
  aws:
    cloud-provider:
    - aws
    cloud-config:
    - "{{ openshift_config_base ~ '/cloudprovider/aws.conf' }}"
    node-labels: "{{ l_node_kubelet_node_labels }}"
  openstack:
    cloud-provider:
    - openstack
    cloud-config:
    - "{{ openshift_config_base ~ '/cloudprovider/openstack.conf' }}"
    node-labels: "{{ l_node_kubelet_node_labels }}"
  gce:
    cloud-provider:
    - gce
    cloud-config:
    - "{{ openshift_config_base ~ '/cloudprovider/gce.conf' }}"
    node-labels: "{{ l_node_kubelet_node_labels }}"
  azure:
    cloud-provider:
    - azure
    cloud-config:
    - "{{ openshift_config_base ~ '/cloudprovider/azure.conf' }}"
    node-labels: "{{ l_node_kubelet_node_labels }}"
  vsphere:
    cloud-provider:
    - vsphere
    cloud-config:
    - "{{ openshift_config_base ~ '/cloudprovider/vsphere.conf' }}"
    node-labels: "{{ l_node_kubelet_node_labels }}"
  undefined:
    node-labels: "{{ l_node_kubelet_node_labels }}"

l_node_kubelet_args_default: "{{ openshift_node_kubelet_args_dict[openshift_cloudprovider_kind | default('undefined')] }}"

l_openshift_node_kubelet_args: "{{ openshift_node_kubelet_args | default({}) }}"
# Combine the default kubelet_args dictionary (based on cloud provider, if provided)
# with user-supplied openshift_node_kubelet_args.
# openshift_node_kubelet_args will override the defaults, if keys and/or subkeys
# are present in both.
l2_openshift_node_kubelet_args: "{{ l_node_kubelet_args_default | combine(l_openshift_node_kubelet_args, recursive=True) }}"
openshift_node_dnsmasq_install_network_manager_hook: true

# lo must always be present in this list or dnsmasq will conflict with
# the node's dns service.
openshift_node_dnsmasq_except_interfaces:
- lo

r_openshift_node_firewall_enabled: "{{ os_firewall_enabled | default(True) }}"
r_openshift_node_use_firewalld: "{{ os_firewall_use_firewalld | default(False) }}"

l_is_node_system_container: "{{ (openshift_use_node_system_container | default(openshift_use_system_containers | default(false)) | bool) }}"

openshift_node_syscon_auth_mounts_l:
- type: bind
  source: "{{ oreg_auth_credentials_path }}"
  destination: "/root/.docker"
  options:
  - ro
  - bind

# If we need to add new mounts in the future, or the user wants to mount data.
# This should be in the same format as auth_mounts_l above.
openshift_node_syscon_add_mounts_l: []


openshift_deployment_type: "{{ openshift_deployment_type | default('origin') }}"

openshift_node_image_dict:
  origin: 'openshift/node'
  openshift-enterprise: 'openshift3/node'
osn_image: "{{ openshift_node_image_dict[openshift_deployment_type] }}"

openshift_service_type_dict:
  origin: origin
  openshift-enterprise: atomic-openshift
openshift_service_type: "{{ openshift_service_type_dict[openshift_deployment_type] }}"

system_images_registry_dict:
  openshift-enterprise: "registry.access.redhat.com"
  origin: "docker.io"

system_images_registry: "{{ system_images_registry_dict[openshift_deployment_type | default('origin')] }}"
openshift_use_external_openvswitch: False
l_is_openvswitch_system_container: "{{ (openshift_use_openvswitch_system_container | default(openshift_use_system_containers | default(false)) | bool) }}"

openshift_image_tag: ''

default_r_openshift_node_image_prep_packages:
- "{{ openshift_service_type }}-master"
- "{{ openshift_service_type }}-node"
- "{{ openshift_service_type }}-docker-excluder"
- ansible
- openvswitch
- docker
- etcd
- haproxy
- dnsmasq
- ntp
- logrotate
- httpd-tools
- bind
- firewalld
- libselinux-python
- conntrack-tools
- openssl
- iproute
- python-dbus
- PyYAML
- yum-utils
# gluster
- glusterfs-fuse
- device-mapper-multipath
# nfs
- nfs-utils
- flannel
- bash-completion
# cockpit
- cockpit-ws
- cockpit-system
- cockpit-bridge
- cockpit-docker
# iscsi
- iscsi-initiator-utils
# ceph
- ceph-common
# systemcontainer
# - runc
# - container-selinux
# - atomic
#
r_openshift_node_image_prep_packages: "{{ default_r_openshift_node_image_prep_packages | union(openshift_node_image_prep_packages | default([])) }}"

openshift_node_bootstrap: False

r_openshift_node_os_firewall_deny: []
default_r_openshift_node_os_firewall_allow:
- service: Kubernetes kubelet
  port: 10250/tcp
- service: Kubernetes kube-proxy health check for service load balancers
  port: 10256/tcp
- service: http
  port: 80/tcp
- service: https
  port: 443/tcp
- service: OpenShift OVS sdn
  port: 4789/udp
  cond: openshift_use_openshift_sdn | bool
- service: Calico BGP Port
  port: 179/tcp
  cond: "{{ openshift_node_use_calico }}"
- service: Kubernetes service NodePort TCP
  port: "{{ openshift_node_port_range | default('') }}/tcp"
  cond: "{{ openshift_node_port_range is defined }}"
- service: Kubernetes service NodePort UDP
  port: "{{ openshift_node_port_range | default('') }}/udp"
  cond: "{{ openshift_node_port_range is defined }}"
- service: Prometheus monitoring
  port: 9000-10000/tcp
- service: Router stats port
  port: 1936/tcp
  cond: "{{ openshift_router_stats_port_enable | default(True) }}"
- service: Contrail VRouter Agent Introspect
  port: 8085/tcp
  cond: "{{ openshift_node_use_contrail }}"
- service: Contrail VRouter Agent Metadata Proxy
  port: 8097/tcp
  cond: "{{ openshift_node_use_contrail }}"
- service: Contrail VRouter Agent Port IPC
  port: 9091/tcp
  cond: "{{ openshift_node_use_contrail }}"
- service: Contrail VRouter Agent NodeMgr
  port: 8102/tcp
  cond: "{{ openshift_node_use_contrail }}"
- service: Contrail Redis Query Port
  port: 6379/tcp
  cond: "{{ openshift_node_use_contrail }}"
- service: Contrail Config Database NodeMgr
  port: 8112/tcp
  cond: "{{ openshift_node_use_contrail }}"
- service: Contrail Config Cassandra
  port: 9041/tcp
  cond: "{{ openshift_node_use_contrail }}"
- service: Contrail Config Cassandra 2
  port: 9161/tcp
  cond: "{{ openshift_node_use_contrail }}"
- service: Contrail Config Cassandra 3
  port: 7010/tcp
  cond: "{{ openshift_node_use_contrail }}"
- service: Contrail Config Zookeeper 1
  port: 2181/tcp
  cond: "{{ openshift_node_use_contrail }}"
- service: Contrail Config Zookeeper 2
  port: 43391/tcp
  cond: "{{ openshift_node_use_contrail }}"
- service: Contrail Config Zookeeper 3
  port: 2888/tcp
  cond: "{{ openshift_node_use_contrail }}"
- service: Contrail Config Zookeeper 4
  port: 3888/tcp
  cond: "{{ openshift_node_use_contrail }}"
- service: Contrail RabbitMQ
  port: 4369/tcp
  cond: "{{ openshift_node_use_contrail }}"
- service: Contrail RabbitMQ 2
  port: 25672/tcp
  cond: "{{ openshift_node_use_contrail }}"
- service: Contrail RabbitMQ 3
  port: 5672/tcp
  cond: "{{ openshift_node_use_contrail }}"
- service: Contrail Controller Database NodeMgr
  port: 8103/tcp
  cond: "{{ openshift_node_use_contrail }}"
- service: Contrail Kafka
  port: 9092/tcp
  cond: "{{ openshift_node_use_contrail }}"
- service: Contrail Kafka 2
  port: 33994/tcp
  cond: "{{ openshift_node_use_contrail }}"
- service: Contrail Analytics Cassandra 1
  port: 9042/tcp
  cond: "{{ openshift_node_use_contrail }}"
- service: Contrail Analytics Cassandra 2
  port: 9160/tcp
  cond: "{{ openshift_node_use_contrail }}"
- service: Contrail Analytics Cassandra 3
  port: 7000/tcp
  cond: "{{ openshift_node_use_contrail }}"
- service: Contrail Analytics Zookeeper
  port: 2182/tcp
  cond: "{{ openshift_node_use_contrail }}"
- service: Contrail Analytics Zookeeper 2
  port: 40799/tcp
  cond: "{{ openshift_node_use_contrail }}"
- service: Contrail Analytics HTTP Opserver
  port: 8090/tcp
  cond: "{{ openshift_node_use_contrail }}"
- service: Contrail Analytics Zookeeper 3
  port: 4888/tcp
  cond: "{{ openshift_node_use_contrail }}"
- service: Contrail Analytics Zookeeper 4
  port: 5888/tcp
  cond: "{{ openshift_node_use_contrail }}"
- service: Contrail Analytics Opserver
  port: 8081/tcp
  cond: "{{ openshift_node_use_contrail }}"
- service: Contrail Analytics HTTP Collector
  port: 8089/tcp
  cond: "{{ openshift_node_use_contrail }}"
- service: Contrail Analytic Collector
  port: 8086/tcp
  cond: "{{ openshift_node_use_contrail }}"
- service: Contrail Analytics Collector Structured Syslog
  port: 3514/tcp
  cond: "{{ openshift_node_use_contrail }}"
- service: Contrail Analytics Query Engine
  port: 8091/tcp
  cond: "{{ openshift_node_use_contrail }}"
- service: Contrail Analytics Snmp Collector
  port: 5920/tcp
  cond: "{{ openshift_node_use_contrail }}"
- service: Contrail Analytics Port Topology
  port: 5921/tcp
  cond: "{{ openshift_node_use_contrail }}"
- service: Contrail Analytics NodeMgr
  port: 8104/tcp
  cond: "{{ openshift_node_use_contrail }}"
- service: Contrail Analytics Alarm Generator
  port: 5995/tcp
  cond: "{{ openshift_node_use_contrail }}"
- service: Contrail Control XMPP
  port: 5269/tcp
  cond: "{{ openshift_node_use_contrail }}"
- service: Contrail Control Control
  port: 8083/tcp
  cond: "{{ openshift_node_use_contrail }}"
- service: Contrail Control DNS
  port: 8092/udp
  cond: "{{ openshift_node_use_contrail }}"
- service: Contrail Control DNS XMPP
  port: 8093/tcp
  cond: "{{ openshift_node_use_contrail }}"
- service: Contrail Control NodeMgr
  port: 8101/tcp
  cond: "{{ openshift_node_use_contrail }}"
- service: Contrail Control BGP
  port: 179/tcp
  cond: "{{ openshift_node_use_contrail }}"
- service: Contrail Config API server
  port: 8082/tcp
  cond: "{{ openshift_node_use_contrail }}"
- service: Contrail Config HTTP API server
  port: 8084/tcp
  cond: "{{ openshift_node_use_contrail }}"
- service: Contrail Config Schema Transformer
  port: 8087/tcp
  cond: "{{ openshift_node_use_contrail }}"
- service: Contrail Config Service Monitor
  port: 8088/tcp
  cond: "{{ openshift_node_use_contrail }}"
- service: Contrail Config Device Manager
  port: 8096/tcp
  cond: "{{ openshift_node_use_contrail }}"
- service: Contrail Config NodeMgr
  port: 8100/tcp
  cond: "{{ openshift_node_use_contrail }}"
- service: Contrail Config API Backend
  port: 9100/tcp
  cond: "{{ openshift_node_use_contrail }}"
- service: Contrail WebUI
  port: 8143/tcp
  cond: "{{ openshift_node_use_contrail }}"
- service: Contrail WebUI 2
  port: 8180/tcp
  cond: "{{ openshift_node_use_contrail }}"
- service: Contrail WebUI Console
  port: 8080/tcp
  cond: "{{ openshift_node_use_contrail }}"
- service: Contrail KubeManager Introspect
  port: 8108/tcp
  cond: "{{ openshift_node_use_contrail }}"
- service: Contrail Openshift WebConsole
  port: 18443/tcp
  cond: "{{ openshift_node_use_contrail }}"
- service: skydns tcp 2 contrail_dns
  port: "53/tcp"
  cond: "{{ openshift_node_use_contrail }}"
- service: skydns udp 2 contrail_dns
  port: "53/udp"
  cond: "{{ openshift_node_use_contrail }}"
# Allow multiple port ranges to be added to the role
r_openshift_node_os_firewall_allow: "{{ default_r_openshift_node_os_firewall_allow | union(openshift_node_open_ports | default([])) }}"

# oreg_url is defined by user input
oreg_host: "{{ oreg_url.split('/')[0] if (oreg_url is defined and '.' in oreg_url.split('/')[0]) else '' }}"
oreg_auth_credentials_path: "{{ openshift_node_data_dir }}/.docker"
oreg_auth_credentials_replace: False
l_bind_docker_reg_auth: False
openshift_use_crio: False
l_crio_use_new_var_sock: "{{ openshift_version | version_compare('3.9', '>=') }}"
l_crio_var_sock: "{{ l_crio_use_new_var_sock | ternary('/var/run/crio/crio.sock', '/var/run/crio.sock') }}"
openshift_docker_alternative_creds: "{{ (openshift_docker_use_system_container | default(False) | bool) or (openshift_use_crio_only | default(False) | bool) }}"

openshift_docker_service_name: "{{ 'container-engine' if (openshift_docker_use_system_container | default(False) | bool) else 'docker' }}"

# These defaults assume forcing journald persistence, fsync to disk once
# a second, rate-limiting to 10,000 logs a second, no forwarding to
# syslog or wall, using 8GB of disk space maximum, using 10MB journal
# files, keeping only a days worth of logs per journal file, and
# retaining journal files no longer than a month.
journald_vars_to_replace:
- { var: Storage, val: persistent }
- { var: Compress, val: yes }
- { var: SyncIntervalSec, val: 1s }
- { var: RateLimitInterval, val: 1s }
- { var: RateLimitBurst, val: 10000 }
- { var: SystemMaxUse, val: 8G }
- { var: SystemKeepFree, val: 20% }
- { var: SystemMaxFileSize, val: 10M }
- { var: MaxRetentionSec, val: 1month }
- { var: MaxFileSec, val: 1day }
- { var: ForwardToSyslog, val: no }
- { var: ForwardToWall, val: no }

# NOTE
# r_openshift_node_*_default may be defined external to this role.
# openshift_use_*, if defined, may affect other roles or play behavior.
openshift_node_use_openshift_sdn_default: "{{ openshift_use_openshift_sdn | default(True) }}"
openshift_node_use_openshift_sdn: "{{ openshift_node_use_openshift_sdn_default }}"

openshift_node_sdn_network_plugin_name_default: "{{ os_sdn_network_plugin_name | default('redhat/openshift-ovs-subnet') }}"
openshift_node_sdn_network_plugin_name: "{{ openshift_node_sdn_network_plugin_name_default }}"

openshift_node_use_calico_default: "{{ openshift_use_calico | default(False) }}"
openshift_node_use_calico: "{{ openshift_node_use_calico_default }}"

openshift_node_use_nuage_default: "{{ openshift_use_nuage | default(False) }}"
openshift_node_use_nuage: "{{ openshift_node_use_nuage_default }}"

openshift_node_use_contiv_default: "{{ openshift_use_contiv | default(False) }}"
openshift_node_use_contiv: "{{ openshift_node_use_contiv_default }}"

openshift_node_use_kuryr_default: "{{ openshift_use_kuryr | default(False) }}"
openshift_node_use_kuryr: "{{ openshift_node_use_kuryr_default }}"

openshift_node_data_dir_default: "{{ openshift_data_dir | default('/var/lib/origin') }}"
openshift_node_data_dir: "{{ openshift_node_data_dir_default }}"

openshift_node_config_dir_default: "/etc/origin/node"
openshift_node_config_dir: "{{ openshift_node_config_dir_default }}"

openshift_node_image_config_latest_default: "{{ openshift_image_config_latest | default(False) }}"
openshift_node_image_config_latest: "{{ openshift_node_image_config_latest_default }}"

openshift_node_use_contrail_default: "{{ openshift_use_contrail | default(False) }}"
openshift_node_use_contrail: "{{ openshift_node_use_contrail_default }}"

openshift_node_use_instance_profiles: False
