Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: Traefik - add local TZ environmental variable #589

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

bcurran3
Copy link
Contributor

What this PR does / why we need it:

Adds local TZ variable to Traefik container.

Looking at logs is very tedious for those of us not living in UTC!

Which issue (if any) this PR fixes:

Fixes #

Any other useful info:

@@ -20,6 +20,7 @@ traefik_log_level: "INFO"
# find the relevant name and environment variables for your DNS provider at https://go-acme.github.io/lego/dns/
traefik_dns_provider: cloudflare
traefik_environment_variables:
TZ: "{{ ansible_nas_timezone }}"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be added directly to the docker_container definition as with other containers. It'll work how it is, but is not in the right place.

Copy link
Contributor Author

@bcurran3 bcurran3 Aug 21, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trying to do this:

    env:
      - TZ: "{{ ansible_nas_timezone }}"
      - "{{ traefik_environment_variables }}"

Results in this:

TASK [traefik : Traefik Docker Container] ******************************************************************************
fatal: [ansible-nas]: FAILED! => {"changed": false, "msg": "argument env is of type <class 'list'> and we were unable to convert to dict: <class 'list'> cannot be converted to a dict"}

Trying this:

    env:
      "{{ traefik_environment_variables }}"
      TZ: "{{ ansible_nas_timezone }}"

Results in this:

Syntax Error while loading YAML.
did not find expected key

I'm not sure how to format this correctly. I don't remember any other roles to look at for an example that use a variable to a list as well as an single env statement in the container.

It just seemed natural to me that if the container was using a variable for the environmental variables defined in defaults, that this should go to there. In fact, I like this ability to much I'm going to update some roles that have a large number of configuration options via environmental variables. My HandBrake addition comes to mind right-away.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants