Skip to main content

Ansible Role: Proxy

Complete Proxy Server Role based on Traefik. This role installs and configures Traefik as a reverse proxy on Debian and Ubuntu systems.

Requirements

This role requires Ansible 2.12 or higher. The target system should be Debian or Ubuntu.

Role Variables

The following variables are defined in defaults/main.yml:

VariableDescriptionDefault Value
traefik_nameName of the service and usertraefik
traefik_versionTraefik version to installv3.6.7
traefik_optInstallation directory/opt/{{ traefik_name }}
traefik_etcConfiguration directory/etc/{{ traefik_name }}
traefik_conf_dDynamic configuration directory{{ traefik_etc }}/conf.d
traefik_global_checkNewVersionCheck for new versionsfalse
traefik_global_sendAnonymousUsageSend anonymous usage datafalse
traefik_entrypointsDictionary defining Traefik entrypoints{ web: { address: ':80' }, websecure: { address: ':443' } }
traefik_apiEnable Traefik APIfalse
traefik_api_dashboardEnable Traefik Dashboardfalse
traefik_api_insecureEnable insecure API accessfalse
traefik_providers_fileEnable file providertrue
traefik_providers_file_directoryDirectory for dynamic configuration files/etc/traefik/conf.d/
traefik_providers_file_watchWatch for changes in dynamic configurationtrue
traefik_log_levelLog levelERROR
traefik_log_formatLog formatcommon
traefik_metrics_prometheusEnable Prometheus metricsfalse
traefik_routing_httpHTTP routing configuration dictionary{}
traefik_routing_tcpTCP routing configuration dictionary{}
traefik_routing_udpUDP routing configuration dictionary{}
traefik_routing_tlsTLS routing configuration dictionary{}

Dependencies

None.

Example Playbook

- hosts: proxy_servers
roles:
- role: ansible_role_proxy
vars:
traefik_api_dashboard: true
traefik_routing_http:
routers:
my-router:
rule: "Host(`example.com`)"
service: my-service
services:
my-service:
loadBalancer:
servers:
- url: "http://1.1.1.1:8080"

License

GPL-3.0-only

Author Information