diff --git a/roles/static_websites/defaults/main.yml b/roles/static_websites/defaults/main.yml index 0fdf255..99c9f2a 100644 --- a/roles/static_websites/defaults/main.yml +++ b/roles/static_websites/defaults/main.yml @@ -21,14 +21,15 @@ # The install location (where to put the docker-compose.yml) static_websites_install_location: /srv/static_websites -# The certresolver to use by traefik for this domain -static_websites_traefik_certresolver: letsencrypt_http +# The default certresolver to use by traefik for the domain if none is specified +static_websites_default_traefik_certresolver: letsencrypt_http # List of all static websites that should be deployed # Available fields: # WEBSITENAME: - The name of the website/entry # image - docker image, can include a tag # domain - domain that is published by traefik +# certresolver - specify traefik cert resolver (optional) # hsts: - HSTS advanced settings (optional) # preloaded - enable preloaded header # subdomains - enable all subdomains header diff --git a/roles/static_websites/templates/docker-compose.yml b/roles/static_websites/templates/docker-compose.yml index 06e3cb3..c86a60d 100644 --- a/roles/static_websites/templates/docker-compose.yml +++ b/roles/static_websites/templates/docker-compose.yml @@ -42,7 +42,7 @@ services: - "traefik.http.routers.static_websites_{{ key }}.rule=Host(`{{ value.domain }}`) && PathPrefix(`/`)" - "traefik.http.routers.static_websites_{{ key }}.entrypoints=websecure" - "traefik.http.routers.static_websites_{{ key }}.tls=true" - - "traefik.http.routers.static_websites_{{ key }}.tls.certresolver={{ static_websites_traefik_certresolver }}" + - "traefik.http.routers.static_websites_{{ key }}.tls.certresolver={{ value.certresolver | default(static_websites_default_traefik_certresolver) }}" - "traefik.http.routers.static_websites_{{ key }}.middlewares=static_websites_{{ key }},compress" - "traefik.http.middlewares.static_websites_{{ key }}.headers.sslredirect=true" - "traefik.http.middlewares.static_websites_{{ key }}.headers.stsSeconds=63072000"