# secure admin resources with basic authentication
[http.middlewares.traefik-auth.basicAuth]
  users = [
    "{{ traefik_admin_username }}:{{ traefik_admin_password }}"
  ]

# admin api (dashboard, rest api, ...)
[http.routers.api]
  rule = "Host(`{{ inventory_hostname }}.{{ domain }}`)"
  entrypoints = ["admin-traefik"]
  middlewares = ["traefik-auth"]
  service = "api@internal"
  [http.routers.api.tls]
    certResolver = "letsencrypt"

# metrics api (prometheus)
[http.routers.metrics]
  rule = "Host(`{{ inventory_hostname }}.{{ domain }}`) && Path(`/metrics`)"
  entrypoints = ["admin-service"]
#  middlewares = ["traefik-auth"]
  service = "prometheus@internal"
  [http.routers.metrics.tls]
    certResolver = "letsencrypt"
