---

traefik_id: "{{ inventory_hostname }}-traefik"

traefik_docker: {
  networks: [
    {
      name: front-tier,
      external: 'true',
    },
  ],
  services: [
    {
      name: "{{ traefik_id }}",
      image_name: "{{ traefik_image_name }}",
      image_version: "{{ traefik_image_version }}",
      environment: [
        'DO_AUTH_TOKEN: "{{ digitalocean_authentication_token }}"',
      ],
      volumes: [
        '"./acme.json:/acme.json"',
        '"./traefik.toml:/traefik.toml:ro"',
        '"./traefik_dynamic.toml:/traefik_dynamic.toml:ro"',
        '"/var/run/docker.sock:/var/run/docker.sock:ro"',
        '"./config/static_files:/var/www/static_files:ro"',
      ],
      networks: [
        '"front-tier"'
      ],
      ports: [
        {
          external: "0.0.0.0:{{ http_port }}",
          internal: "{{ http_port }}"
        },
        {
          external: "0.0.0.0:{{ https_port }}",
          internal: "{{ https_port }}"
        },
        {
          external: "0.0.0.0:{{ service_port_git }}",
          internal: "{{ service_port_git }}"
        },
        {
          external: "0.0.0.0:{{ service_port_pgadmin }}",
          internal: "{{ service_port_pgadmin }}"
        },
        {
          external: "0.0.0.0:{{ service_port_phpmyadmin }}",
          internal: "{{ service_port_phpmyadmin }}"
        },
        {
          external: "0.0.0.0:{{ admin_port_traefik }}",
          internal: "{{ admin_port_traefik }}"
        },
        {
          external: "0.0.0.0:{{ admin_port_service }}",
          internal: "{{ admin_port_service }}"
        },
        {
          external: "0.0.0.0:{{ monitor_port_docker }}",
          internal: "{{ monitor_port_docker }}"
        },
        {
          external: "0.0.0.0:{{ monitor_port_harbor }}",
          internal: "{{ monitor_port_harbor }}"
        },
      ],
    }
  ]
}
