---

kibana_id: "{{ inventory_hostname }}-kibana"

kibana_labels: [
  '"traefik.enable=true"',
  '"traefik.http.routers.{{ kibana_id }}.service={{ kibana_id }}"',
  '"traefik.http.routers.{{ kibana_id }}.rule=Host(`{{ kibana_id }}.{{ domain }}`)"',
  '"traefik.http.routers.{{ kibana_id }}.entrypoints=websecure"',
  '"traefik.http.routers.{{ kibana_id }}.tls=true"',
  '"traefik.http.routers.{{ kibana_id }}.tls.certresolver=letsencrypt"',
  '"traefik.http.services.{{ kibana_id }}.loadbalancer.server.port={{ service_port_kibana }}"',
]

elastic_docker: {
  networks: [
    {
      name: front-tier,
      external: true,
    },
  ],
  services: [
    {
      name: "{{ kibana_id }}",
      image_name: "{{ kibana_image_name }}",
      image_version: "{{ kibana_image_version }}",
      labels: "{{ kibana_labels + ( kibana_labels_additional | default([])) }}",
      environment: [
        "SERVER_NAME: {{ kibana_id }}",
        "SERVER_PUBLICBASEURL: https://{{ kibana_id }}.{{ domain }}",
        "ELASTICSEARCH_URL: https://{{ shared_service_elastic_stack_01_hostname }}:9200",
        "ELASTICSEARCH_HOSTS: '[\"https://{{ shared_service_elastic_stack_01_hostname }}:9200\"]'",
        "ELASTICSEARCH_SSL_CERTIFICATEAUTHORITIES: /usr/share/elasticsearch/config/certificates/ca/ca.crt",
        "ELASTICSEARCH_USERNAME: \"{{ elastic_admin_username }}\"",
        "ELASTICSEARCH_PASSWORD: \"{{ elastic_admin_password }}\"",
      ],
      volumes: [
        '"./certs:/usr/share/elasticsearch/config/certificates:ro"',
      ],
      networks: [
        '"front-tier"',
      ],
      extra_hosts: "{{ elastic_extra_hosts | default([]) }}",
    }
  ],
}
