---
# TODO variable shouldn't used in a global way
elastic_id: "{{ inventory_hostname }}-elastic"
# TODO variable shouldn't used in a global way
elastic_exporter_id: "{{ inventory_hostname }}-elastic-exporter"

shared_service_url_harbor: "https://{{ shared_service_hostname_harbor }}"
shared_service_hostname_harbor: "{{ stage }}-harbor-01.{{ domain_env }}"
shared_service_url_gitea: "https://{{ shared_service_hostname_gitea }}"
shared_service_hostname_gitea: "{{ stage }}-gitea-01.{{ domain_env }}"
shared_service_url_keycloak: "https://{{ shared_service_hostname_keycloak }}"
shared_service_hostname_keycloak: "{{ stage }}-keycloak-01.{{ domain_env }}"
shared_service_url_kibana: "https://{{ shared_service_hostname_kibana }}"
shared_service_hostname_kibana: "{{ stage }}-elastic-stack-kibana-01-kibana.{{ domain_env }}"
shared_service_host_management: "{{ stage }}-management-01"
shared_service_url_management: "https://{{ shared_service_hostname_management }}"
shared_service_hostname_management: "{{ shared_service_host_management }}-connect.{{ domain_env }}"

shared_service_hostname_logstash: "{{ stage }}-elastic-stack-logstash-01"

# use private loadbalancer ip for all kubernetes services
stage_kube: "{{ stage }}"
shared_service_kube_url_argocd: "https://{{ shared_service_kube_hostname_argocd }}"
shared_service_kube_hostname_argocd: "{{ stage_kube }}-argocd.{{ domain_env }}"
shared_service_kube_url_awx: "https://{{ shared_service_kube_hostname_awx }}"
shared_service_kube_hostname_awx: "{{ stage_kube }}-awx.{{ domain_env }}"
shared_service_kube_url_gitea: "https://{{ shared_service_kube_hostname_gitea }}"
shared_service_kube_hostname_gitea: "{{ stage_kube }}-gitea.{{ domain_env }}"
shared_service_kube_url_harbor: "https://{{ shared_service_kube_hostname_harbor }}"
shared_service_kube_hostname_harbor: "{{ stage }}-harbor.{{ domain_env }}"
shared_service_kube_url_kibana: "https://{{ shared_service_kube_hostname_kibana }}"
shared_service_kube_hostname_kibana: "{{ stage_kube }}-kibana.{{ domain_env }}"
shared_service_kube_url_prometheus: "https://{{ shared_service_kube_hostname_prometheus }}"
shared_service_kube_hostname_prometheus: "{{ stage_kube }}-prometheus.{{ domain_env }}"
shared_service_kube_jaeger_collector_hostname: "{{ stage_kube }}-jaeger-collector.{{ domain_env }}"

shared_service_kube_loadbalancer_public_ip_not_available: "public loadbalancer ip not available"
shared_service_kube_loadbalancer_public_ip: "{{ stage_public_ingress_loadbalancer_ip | default(shared_service_kube_loadbalancer_public_ip_not_available) }}"
shared_service_kube_loadbalancer_private_ip_not_available: "private loadbalancer ip not available"
shared_service_kube_loadbalancer_private_ip: "{{ stage_private_ingress_loadbalancer_ip | default(shared_service_kube_loadbalancer_private_ip_not_available) }}"
shared_service_loadbalancer_logstash_public_ip_not_available: "public logstash loadbalancer ip not available"
shared_service_loadbalancer_logstash_public_ip: "{{ stage_public_logstash_loadbalancer_ip | default(shared_service_loadbalancer_logstash_public_ip_not_available) }}"
shared_service_loadbalancer_logstash_private_ip_not_available: "private logstash loadbalancer ip not available"
shared_service_loadbalancer_logstash_private_ip: "{{ stage_private_logstash_loadbalancer_ip | default(shared_service_loadbalancer_logstash_private_ip_not_available) }}"

shared_service_default_additional_hosts:
  - name: "{{ shared_service_kube_hostname_argocd }}"
    ip: "{{ shared_service_kube_loadbalancer_private_ip }}"
  - name: "{{ shared_service_kube_hostname_awx }}"
    ip: "{{ shared_service_kube_loadbalancer_private_ip }}"
  - name: "{{ shared_service_kube_hostname_gitea }}"
    ip: "{{ shared_service_kube_loadbalancer_private_ip }}"
  - name: "{{ shared_service_kube_hostname_harbor }}"
    ip: "{{ shared_service_kube_loadbalancer_private_ip }}"
  - name: "{{ shared_service_kube_hostname_kibana }}"
    ip: "{{ shared_service_kube_loadbalancer_private_ip }}"
  - name: "{{ shared_service_kube_hostname_prometheus }}"
    ip: "{{ shared_service_kube_loadbalancer_private_ip }}"
  - name: "{{ shared_service_kube_jaeger_collector_hostname }}"
    ip: "{{ shared_service_kube_loadbalancer_private_ip }}"

shared_service_additional_hosts: "{{ shared_service_default_additional_hosts + (shared_service_custom_additional_hosts | default([])) }}"
