Removed insecure option

Removed the insecure api option and moved options/ports to a
variable.
This commit is contained in:
Kris Lamoureux 2019-12-02 19:39:13 -05:00
parent 7be5efe1dd
commit 61542aba88
Signed by: kris
GPG Key ID: 3EDA9C3441EDA925
2 changed files with 22 additions and 7 deletions

View File

@ -1,5 +1,9 @@
traefik_name: traefik traefik_name: traefik
traefik_version: latest traefik_version: latest
traefik_port: 8000 traefik_options:
traefik_admin_port: 8080 - "--providers.docker"
traefik_domain: localhost - "--providers.docker.exposedbydefault=false"
- "--entrypoints.web.address=:80"
- "--api=true"
traefik_ports:
- "80:80"

View File

@ -1,12 +1,23 @@
- name: Create traefik network
docker_network:
name: traefik-net
- name: Start Traefik container - name: Start Traefik container
docker_container: docker_container:
name: "{{ traefik_name }}" name: "{{ traefik_name }}"
image: traefik:{{ traefik_version }} image: traefik:{{ traefik_version }}
command: --api.insecure=true --providers.docker --providers.docker.exposedbydefault=false command: "{{ traefik_options }}"
state: started state: started
restart_policy: always restart_policy: always
ports: ports: "{{ traefik_ports }}"
- "{{ traefik_port }}:80" networks_cli_compatible: "false"
- "{{ traefik_admin_port }}:8080" networks:
- name: "traefik-net"
labels:
traefik.http.routers.traefik.rule: "Host(`{{ traefik_domain }}`)"
traefik.http.routers.traefik.service: "api@internal"
traefik.http.middlewares.traefik.basicauth.users: "{{ traefik_auth }}"
traefik.docker.network: "proxy_traefik-net"
traefik.enable: "true"
volumes: volumes:
- /var/run/docker.sock:/var/run/docker.sock - /var/run/docker.sock:/var/run/docker.sock