I have my docker config such that all options comes from labels and command options.
I want to add my owns certs, but it seems I can only add them from the config file.
As soon as I specify a config file, none of my other command options that specify docker and entrypoints are loaded.
Can I specify certs using command options, or is there a way to combine the config file with command options?
traefik.toml:
[providers]
[providers.file]
filename = "/config/certificates.toml"
certificates.tokl:
[[tls.certificates]]
certFile = "/config/star_insanegenius_net.crt"
keyFile = "/config/star_insanegenius_net.key"
[[tls.certificates]]
certFile = "/config/star_home_insanegenius_net.crt"
keyFile = "/config/star_home_insanegenius_net.key"
Ansible task:
- name: 'Install Traefik'
docker_container:
name: traefik
image: traefik
pull: true
hostname: "traefik-{{ ansible_hostname }}"
domainname: "{{ ansible_domain }}"
restart_policy: unless-stopped
command:
- "--log.level=DEBUG"
- "--api.dashboard=true"
- "--api.insecure=true"
- "--configfile=/config/traefik.toml"
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=false"
- "--providers.docker.network={{ docker_local_network }}"
# SMTP port 25
- "--entrypoints.smtp.address=:25"
# HTTP port 80
- "--entrypoints.web.address=:80"
- "--entrypoints.web.http.redirections.entrypoint.to=websecure"
- "--entrypoints.web.http.redirections.entrypoint.scheme=https"
# HTTPS port 443
- "--entrypoints.websecure.address=:443"
- "--entrypoints.websecure.http.tls=true"
#- "--entrypoints.websecure.http.tls.certresolver=dns-cloudflare"
#- "--entrypoints.websecure.http.tls.domains[0].main={{ ansible_fqdn }}"
#- "--entrypoints.websecure.http.tls.domains[0].sans=*.{{ ansible_domain }}"
#- "--entrypoints.websecure.http.tls.domains[1].main={{ external_domain }}"
#- "--entrypoints.websecure.http.tls.domains[1].sans=*.{{ external_domain }}"
# SSL certs
#- "--certificatesresolvers.dns-cloudflare.acme.email={{ cloudflare_email }}"
#- "--certificatesresolvers.dns-cloudflare.acme.storage=/config/acme.json"
#- "--certificatesResolvers.dns-cloudflare.acme.dnschallenge.provider=cloudflare"
env:
TZ: "America/Los_Angeles"
#CF_DNS_API_TOKEN: "{{ cloudflare_dns_api_token }}"
volumes:
- "{{ appdata_dir }}/traefik/config:/config"
- "/var/run/docker.sock:/var/run/docker.sock"
networks_cli_compatible: yes
purge_networks: yes
networks:
- name: "{{ docker_local_network }}"
published_ports:
- 80:80
- 443:443
- 8080:8080