{"id":48178906,"url":"https://github.com/exterrestris/ansible-role-traefik","last_synced_at":"2026-04-04T17:41:39.460Z","repository":{"id":42445401,"uuid":"349763067","full_name":"exterrestris/ansible-role-traefik","owner":"exterrestris","description":"Ansible role to install and configure Traefik","archived":false,"fork":false,"pushed_at":"2026-03-21T05:32:16.000Z","size":56,"stargazers_count":1,"open_issues_count":11,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-03-21T21:28:25.186Z","etag":null,"topics":["ansible","ansible-role","proxy","traefik","traefik-docker"],"latest_commit_sha":null,"homepage":"","language":"Jinja","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/exterrestris.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-03-20T15:29:22.000Z","updated_at":"2026-03-21T05:32:20.000Z","dependencies_parsed_at":"2022-09-21T03:43:56.794Z","dependency_job_id":null,"html_url":"https://github.com/exterrestris/ansible-role-traefik","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/exterrestris/ansible-role-traefik","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/exterrestris%2Fansible-role-traefik","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/exterrestris%2Fansible-role-traefik/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/exterrestris%2Fansible-role-traefik/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/exterrestris%2Fansible-role-traefik/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/exterrestris","download_url":"https://codeload.github.com/exterrestris/ansible-role-traefik/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/exterrestris%2Fansible-role-traefik/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31407648,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-04T10:20:44.708Z","status":"ssl_error","status_checked_at":"2026-04-04T10:20:06.846Z","response_time":60,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ansible","ansible-role","proxy","traefik","traefik-docker"],"created_at":"2026-04-04T17:41:39.383Z","updated_at":"2026-04-04T17:41:39.451Z","avatar_url":"https://github.com/exterrestris.png","language":"Jinja","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Ansible role `exterrestris.traefik`\n\nAn Ansible role to install and configure [Traefik](https://traefik.io/traefik/) as either a Docker image using Docker Compose, or a system service\n\n## Requirements\n\n### Installed using Docker\n- Docker\n- Docker Compose\n- docker and docker-compose Python libraries\n\n### Installed as service\n- systemd\n\n## Role Variables\n\n### Installation\n| Variable | Default | Comments |\n| :--- | :--- | :--- |\n| `traefik_install` | `\"docker\"` | Install method. Specify `\"docker\"` to install as Docker image, `\"binary\"` to install binary release as systemd service |\n\n#### Install as Docker image\n| Variable | Default | Comments |\n| :--- | :--- | :--- |\n| `traefik_docker_image` | `\"traefik:v2.4\"` | Image to pull from Docker Hub |\n\n#### Install as Service\n| Variable | Default | Comments |\n| :--- | :--- | :--- |\n| `traefik_binary_version` | `\"latest\"` | Version to download. `\"latest\"` will select the most recent release |\n| `traefik_download_dir` | `\"/tmp/traefik\"` | Directory to download/extract release archive |\n| `traefik_install_dir` | `\"/usr/local/bin\"` | Directory to install binary to |\n| `traefik_service_user` | `\"traefik\"` | System user to run service as. Will be created if user does not exist |\n\n### Configuration\n| Variable | Default | Comments |\n| :--- | :--- | :--- |\n| `traefik_config_dir` | `\"/etc/traefik\"` | Directory to store Traefik config files |\n| `traefik_entrypoints` | `\"{{ traefik_default_entrypoints }}\"` | Entry Point definitions |\n| `traefik_providers` | `\"{{ traefik_default_providers }}\"` | Provider definitions |\n| `traefik_tls_certificates` | `[]` | Certificates to provide to Trafik |\n| `traefik_routers` | `[]` | Router definitions |\n| `traefik_services` | `[]` | Service definitions |\n| `traefik_log_dir` | `\"/var/log/traefik\"` | Directory to store Traefik log files |\n| `traefik_log_enabled` | `no` | Enable system log |\n| `traefik_log_file` | `\"traefik.log\"` | System log filename |\n| `traefik_access_log_enabled` | `no` | Enable access log |\n| `traefik_access_log_file` | `\"access.log\"` | Access log filename |\n| `traefik_dashboard` | `true` | Enable dashboard |\n| `traefik_dashboard_router_name` | `\"dashboard\"` | Name for dashboard router |\n| `traefik_dashboard_entrypoints` | `[\"{{ traefik_http_entrypoint_name }}\", \"{{ traefik_https_entrypoint_name }}\"]` | Entrypoints to bind dashboard router to |\n| `traefik_insecure_api` | `false` | Enable insecure API access |\n\n### Default overrides\n| Variable | Default | Comments |\n| :--- | :--- | :--- |\n| `traefik_http_entrypoint_name` | `\"http\"` | Name for default HTTP entrypoint |\n| `traefik_https_entrypoint_name` | `\"https\"` | Name for default HTTPS entrypoint |\n| `traefik_provider_file_watch` | `true` | Watch files in `traefik_provider_file_directory` for changes |\n\n#### `traefik_entrypoints[]`\n| Variable | Default | Comments |\n| :--- | :--- | :--- |\n| `name` | *Required* | Entrypoint name |\n| `port` | *Required* | Entrypoint port |\n| `host` | `\"\"` | Host IP to listen on. Defaults to any IP |\n| `protocol` | `\"\"` | Protocol to listen to (`\"tcp\"` or `\"udp\"`). Defaults to unspecified (effectively `\"tcp\"`) |\n| `http` | `{}` | HTTP specific options |\n| `http.redirect.to` | `\"\"` | Entrypoint to redirect traffic to |\n\n#### `traefik_providers[]`\n| Variable | Default | Comments |\n| :--- | :--- | :--- |\n| `type` | *Required* | Provider type |\n| *`option`* | `\"\"` | Provider option |\n\nAll provider options are supported, and will be output as specified. No default options are set for any provider - everything required by the provider type must be specified\n\n#### `traefik_tls_certificates[]`\nTLS certificates need to be installed in `{{ traefik_config_dir }}`/certificates\n\n| Variable | Default | Comments |\n| :--- | :--- | :--- |\n| `cert` | *Required* | Filename for the full certificate chain |\n| `key` | *Required* | Filename for the private key |\n| `default` | `no` | Set as the default certificate |\n\n#### `traefik_routers[]`\n| Variable | Default | Comments |\n| :--- | :--- | :--- |\n| `name` | *Required* | Router name |\n| `type` | `\"http\"` | Router type: `\"http\"`, `\"tcp\"` or `\"udp\"`  |\n| `rule` | *Required* | Rule to match |\n| `service` | *Required* | Service to route to |\n| `entrypoints` | `[]` | List of entrypoints to bind router definition to |\n| `create` | `\"both\"` | For `\"http\"` and `\"tcp\"` router types, specifies whether to create secure (`\"secure\"`), insecure (`\"insecure\"`), or both secure and insecure (`\"both\"`) router defintions. If both secure and insecure definitions are created, the same settings will be applied to both definitions.\n\n#### `traefik_services[]`\n| Variable | Default | Comments |\n| :--- | :--- | :--- |\n| `name` | *Required* | Service name |\n| `type` | `\"http\"` | Service type: `\"http\"`, `\"tcp\"` or `\"udp\"` |\n| `servers` | *Required* | List of server URLs to load balance between |\n\n#### Docker specific configuration\n| Variable | Default | Comments |\n| :--- | :--- | :--- |\n| `traefik_docker_compose` | `\"{{ traefik_config_dir }}\"` | Location for generated `docker-compose.yaml` |\n| `traefik_docker_service_name` | `\"traefik\"` | Name of service in `docker-compose.yaml` |\n| `traefik_docker_networks` | `\"{{ traefik_default_docker_networks }}\"` | Networks to create in `docker-compose.yaml`. Traefik container will be attached to all networks listed |\n| `traefik_docker_network` | `\"traefik\"` | Name of default network |\n| `traefik_docker_network_driver` | `\"bridge\"` | Driver type for default network  |\n| `traefik_docker_network_driver_options` | `\"{}\"` | Driver options for default network |\n| `traefik_docker_network_alias` | `\"{{ traefik_docker_network }}\"` | \"Public\" name for default network |\n| `traefik_docker_socket` | `\"/var/run/docker.sock\"` | Path to Docker socket. Will be bound to same path in container |\n| `traefik_provider_docker_endpoint` | `\"unix://{{ traefik_docker_socket }}\"` | Endpoint for Docker provider |\n\n##### `traefik_docker_networks[]`\n| Variable | Default | Comments |\n| :--- | :--- | :--- |\n| `name` | *Required* | Internal name for the network |\n| `external` | `false` | Network created outside of `docker-compose.yaml` |\n| `alias` | `\"\"` | \"Public\" name for the network |\n| `driver` | `\"\"` | Driver to use for the network |\n| `driver_opts` | `{}` | Driver options for the network |\n\n## Defaults\n\n### Predefined Variables\n| Variable | Value | Comments |\n| :--- | :--- | :--- |\n| `traefik_provider_file_directory` | `\"{{ traefik_config_dir }}/conf.d\"` | Location for dynamic configuration files |\n| `traefik_tls_certificate_dir` | `\"{{ traefik_config_dir }}/certificates\"` | Location for TLS certificates |\n\n### Entrypoints\n\nTwo entrypoints are defined by default, listening to all available IP addresses - an HTTP entrypoint on port 80, and a corresponding HTTPS entrypoint on port 443. The HTTP entrypoint is configured to redirect all traffic to the HTTPS entrypoint automatically.\n\n```Yaml\ntraefik_default_entrypoints:\n  - \"{{ traefik_default_http_entrypoint }}\"\n  - \"{{ traefik_default_https_entrypoint }}\"\n\ntraefik_default_http_entrypoint:\n  name: \"{{ traefik_http_entrypoint_name }}\"\n  port: 80\n  http:\n    redirect:\n      to: \"{{ traefik_https_entrypoint_name }}\"\n      scheme: 'https'\n\ntraefik_default_https_entrypoint:\n  name: \"{{ traefik_https_entrypoint_name }}\"\n  port: 443\n```\n\n### Providers\nTwo providers are configured by default - a file provider, and a docker provider. These can be removed by replacing the definitions, however be aware that all the dynamic configuration files (e.g. the dashboard router, supplied `traefik_tls_certificates` etc.) are generated in `traefik_provider_file_directory` and require that a file provider pointing to that directory exists in order to be used\n\n```Yaml\ntraefik_default_providers:\n  - \"{{ traefik_default_docker_provider }}\"\n  - \"{{ traefik_default_file_provider }}\"\n\ntraefik_default_docker_provider:\n  type: \"docker\"\n  endpoint: \"{{ traefik_provider_docker_endpoint }}\"\n\ntraefik_default_file_provider:\n  type: \"file\"\n  directory: \"{{ traefik_provider_file_directory }}\"\n  watch: \"{{ traefik_provider_file_watch }}\"\n```\n\n### Docker Networks\nOne network definition is provided by default\n\n```Yaml\ntraefik_default_docker_network:\n  name: \"{{ traefik_docker_network }}\"\n  external: false\n  alias: \"{{ traefik_docker_network_alias }}\"\n  driver: \"{{ traefik_docker_network_driver }}\"\n  driver_opts: \"{{ traefik_docker_network_driver_options }}\"\n\ntraefik_default_docker_networks:\n  - \"{{ traefik_default_docker_network }}\"\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fexterrestris%2Fansible-role-traefik","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fexterrestris%2Fansible-role-traefik","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fexterrestris%2Fansible-role-traefik/lists"}