Ansible galaxy role to deploy Traefik in docker
The purpose of this Ansible role is to allow you to manage a Traefik reverse proxy.
With this role you will be able to generate deploy a Traefik container on you server, configure desired HTTP/HTTPS redirections and generate HTTPS associated certificates (thanks to Let's Encrypt).
The following packages have to be installed and well configured on the host :
The following vars have to be defined on each execution by the user to configure the reverse proxy mappings
traefik_endpoints:
endpoint_name:
# Fontend match on host to trigger the redirection
host: "test.localhost"
# Backend url to redirect to
dest: "http://perdu.com"
# If true generate let's encrypt certificate for specified host
host_gen_cert: true
traefik_container_name: "traefik"
traefik_root_location: "/opt/docker-data/{{ traefik_container_name }}"
traefik_conf_location: "{{ traefik_root_location }}/conf"
traefik_certs_location: "{{ traefik_root_location }}/certs"
traefik_http_port: 80
traefik_https_port: 443
traefik_http_admin_port: 8080
traefik_le_staging: true
Let's encrypt staging environnement documentation
traefik_le_contact_email: [email protected]
traefik_docker_networks: []
#traefik_docker_networks:
# - name: "docker_network"
traefik_container_restart_policy: "always" #(always, no, on-failure, unless-stopped)
--
See tests/test.yml
ansible-playbook tests/test.yml --ask-sudo-password -e traefik_root_location="$(PWD)/.workdir/"
- hosts: localhost
roles:
- role: ../ansible-traefik-in-docker
traefik_http_port: 8090
traefik_http_admin_port: 8080
traefik_https_port: 4443
traefik_le_staging: true
traefik_endpoints:
influxdb:
host: "test.localhost"
dest: "http://perdu.com"
host_gen_cert: false
MIT