diff --git a/roles/traefik/defaults/main.yml b/roles/traefik/defaults/main.yml index cd1ffce..da19be4 100644 --- a/roles/traefik/defaults/main.yml +++ b/roles/traefik/defaults/main.yml @@ -1,9 +1,7 @@ traefik_name: traefik traefik_version: latest traefik_options: - - "--providers.docker" - - "--providers.docker.exposedbydefault=false" - "--entrypoints.web.address=:80" - - "--api=true" + - "--api.dashboard=true" traefik_ports: - "80:80" diff --git a/roles/traefik/tasks/main.yml b/roles/traefik/tasks/main.yml index ea7fc61..bc785ee 100644 --- a/roles/traefik/tasks/main.yml +++ b/roles/traefik/tasks/main.yml @@ -1,4 +1,10 @@ -- name: Create traefik network +- name: Set default Traefik options + set_fact: + traefik_defaults: + - "--providers.docker" + - "--providers.docker.exposedbydefault=false" + +- name: Create Traefik network docker_network: name: traefik-net @@ -6,7 +12,7 @@ docker_container: name: "{{ traefik_name }}" image: traefik:{{ traefik_version }} - command: "{{ traefik_options }}" + command: "{{ traefik_defaults + traefik_options }}" state: started restart_policy: always ports: "{{ traefik_ports }}"