Correct and synchronized timezone in system/containers

master
Quentin Duchemin 2021-07-23 14:04:42 +02:00
parent 86afff5c7b
commit ee97488ffb
Signed by: Chosto
GPG Key ID: 0547178FEEDE7D6B
15 changed files with 42 additions and 2 deletions

View File

@ -2,6 +2,7 @@
``` ```
pip install -r requirements.txt pip install -r requirements.txt
ansible-galaxy collection install community.general
``` ```
### Ansible Vault ### Ansible Vault

View File

@ -4,6 +4,7 @@ firewall_in_ports:
- "{{ ssh_port }}" - "{{ ssh_port }}"
hostname: "{{ base_user_name }}" hostname: "{{ base_user_name }}"
timezone: Europe/Paris
ssh_port: "2220" ssh_port: "2220"

View File

@ -5,7 +5,7 @@
- name: Install and configure Funkwhale, deezloader and beets - name: Install and configure Funkwhale, deezloader and beets
include_role: include_role:
name: music name: music
tasks_from: funkwhale tasks_from: main
apply: apply:
tags: install tags: install
tags: install tags: install

View File

@ -4,3 +4,5 @@ ihl_base_apt_cache_time: 3600
ihl_base_additional_groups: [] ihl_base_additional_groups: []
ihl_base_users: [] ihl_base_users: []
ihl_base_ssh_users: [] ihl_base_ssh_users: []
timezone: Europe/Paris

View File

@ -2,6 +2,10 @@
tags: tags:
- apt - apt
- include: timezone.yml
tags:
- timezone
- include: users.yml - include: users.yml
tags: tags:
- users - users

View File

@ -0,0 +1,3 @@
- name: Set correct timezone
community.general.timezone:
name: "{{ timezone }}"

View File

@ -15,6 +15,8 @@ services:
container_name: grav_lola container_name: grav_lola
volumes: volumes:
- grav_lola:/var/www/html - grav_lola:/var/www/html
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
networks: networks:
- proxy - proxy
labels: labels:

View File

@ -25,6 +25,8 @@ services:
image: "klakegg/hugo:{{ hugo_version }}" image: "klakegg/hugo:{{ hugo_version }}"
volumes: volumes:
- website_files:/src - website_files:/src
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
# Hugo will build only # Hugo will build only
# when triggered # when triggered
restart: on-failure restart: on-failure
@ -34,6 +36,8 @@ services:
image: nginx:alpine image: nginx:alpine
volumes: volumes:
- website_public:/usr/share/nginx/html:ro - website_public:/usr/share/nginx/html:ro
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
labels: labels:
traefik.http.routers.hugo.entrypoints: websecure traefik.http.routers.hugo.entrypoints: websecure
traefik.http.routers.hugo.rule: "Host(`blog.{{ domain_name }}`)" traefik.http.routers.hugo.rule: "Host(`blog.{{ domain_name }}`)"

View File

@ -18,6 +18,8 @@ services:
image: "lycheeorg/lychee:{{ lychee_version }}" image: "lycheeorg/lychee:{{ lychee_version }}"
volumes: volumes:
- uploads:/uploads - uploads:/uploads
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
labels: labels:
traefik.http.routers.lychee.entrypoints: websecure traefik.http.routers.lychee.entrypoints: websecure
traefik.http.routers.lychee.rule: "Host(`pic.{{ domain_name }}`)" traefik.http.routers.lychee.rule: "Host(`pic.{{ domain_name }}`)"
@ -47,6 +49,7 @@ services:
container_name: lychee_db container_name: lychee_db
volumes: volumes:
- db:/var/lib/postgresql/data - db:/var/lib/postgresql/data
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro - /etc/localtime:/etc/localtime:ro
environment: environment:
POSTGRES_USER: lychee POSTGRES_USER: lychee

View File

@ -26,6 +26,8 @@ services:
- C_FORCE_ROOT=true - C_FORCE_ROOT=true
volumes: volumes:
- "{{ funkwhale_import_music_directory_host }}:{{ funkwhale_import_music_directory }}:ro" - "{{ funkwhale_import_music_directory_host }}:{{ funkwhale_import_music_directory }}:ro"
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
command: celery -A funkwhale_api.taskapp worker -l INFO command: celery -A funkwhale_api.taskapp worker -l INFO
networks: networks:
- db - db
@ -49,6 +51,8 @@ services:
- "{{ funkwhale_import_music_directory_host }}:{{ funkwhale_import_music_directory }}:ro" - "{{ funkwhale_import_music_directory_host }}:{{ funkwhale_import_music_directory }}:ro"
- "static:{{ funkwhale_static_root }}" - "static:{{ funkwhale_static_root }}"
- "frontend:{{ funkwhale_frontend }}" - "frontend:{{ funkwhale_frontend }}"
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
labels: labels:
traefik.http.routers.funkwhale_api.entrypoints: websecure traefik.http.routers.funkwhale_api.entrypoints: websecure
traefik.http.routers.funkwhale_api.rule: "Host(`api.{{ funkwhale_subdomain }}.{{ domain_name }}`)" traefik.http.routers.funkwhale_api.rule: "Host(`api.{{ funkwhale_subdomain }}.{{ domain_name }}`)"
@ -69,6 +73,8 @@ services:
- "{{ funkwhale_import_music_directory_host }}:{{ funkwhale_import_music_directory }}:ro" - "{{ funkwhale_import_music_directory_host }}:{{ funkwhale_import_music_directory }}:ro"
- "static:{{ funkwhale_static_root }}" - "static:{{ funkwhale_static_root }}"
- "frontend:{{ funkwhale_frontend }}" - "frontend:{{ funkwhale_frontend }}"
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
labels: labels:
traefik.http.routers.funkwhale.entrypoints: websecure traefik.http.routers.funkwhale.entrypoints: websecure
traefik.http.routers.funkwhale.rule: "Host(`{{ funkwhale_subdomain }}.{{ domain_name }}`)" traefik.http.routers.funkwhale.rule: "Host(`{{ funkwhale_subdomain }}.{{ domain_name }}`)"
@ -84,6 +90,8 @@ services:
env_file: ./conf.env env_file: ./conf.env
volumes: volumes:
- redis:/data - redis:/data
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
networks: networks:
- db - db
restart: unless-stopped restart: unless-stopped
@ -95,6 +103,10 @@ services:
POSTGRES_USER: funkwhale POSTGRES_USER: funkwhale
POSTGRES_DB: funkwhale POSTGRES_DB: funkwhale
POSTGRES_PASSWORD: "{{ funkwhale_db_password }}" POSTGRES_PASSWORD: "{{ funkwhale_db_password }}"
TZ: Europe/Paris
PGTZ: Europe/Paris
# Don't mount /etc/localtime, it screws with pg_timezone_names
# TZ and PGTZ environment are sufficient.
volumes: volumes:
- db:/var/lib/postgresql/data - db:/var/lib/postgresql/data
networks: networks:

View File

@ -22,4 +22,5 @@
remove_orphans: yes remove_orphans: yes
pull: yes pull: yes
recreate: smart recreate: smart
state: present state: absent
ignore_errors: yes

View File

@ -15,6 +15,8 @@ services:
container_name: nextcloud container_name: nextcloud
volumes: volumes:
- nextcloud:/var/www/html - nextcloud:/var/www/html
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
labels: labels:
traefik.http.routers.cloud.entrypoints: websecure traefik.http.routers.cloud.entrypoints: websecure
traefik.http.routers.cloud.rule: "Host(`cloud.{{ domain_name }}`)" traefik.http.routers.cloud.rule: "Host(`cloud.{{ domain_name }}`)"

View File

@ -12,6 +12,7 @@ services:
- "{{ traefik_http_port }}:80" - "{{ traefik_http_port }}:80"
- "{{ traefik_https_port}}:443" - "{{ traefik_https_port}}:443"
volumes: volumes:
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro - /etc/localtime:/etc/localtime:ro
- /var/run/docker.sock:/var/run/docker.sock - /var/run/docker.sock:/var/run/docker.sock
- ./traefik.toml:/traefik.toml - ./traefik.toml:/traefik.toml

View File

@ -14,6 +14,8 @@ services:
volumes: volumes:
- {{ websites_basepath }}/{{ website.name }}:/var/www/html:ro - {{ websites_basepath }}/{{ website.name }}:/var/www/html:ro
- {{ websites_basepath }}/{{ website.name }}.conf:/etc/nginx/conf.d/default.conf:ro - {{ websites_basepath }}/{{ website.name }}.conf:/etc/nginx/conf.d/default.conf:ro
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
labels: labels:
traefik.http.routers.{{ website.name }}.entrypoints: websecure traefik.http.routers.{{ website.name }}.entrypoints: websecure
traefik.http.routers.{{ website.name }}.rule: "Host(`{{ website.name }}.{{ domain_name }}`)" traefik.http.routers.{{ website.name }}.rule: "Host(`{{ website.name }}.{{ domain_name }}`)"
@ -43,5 +45,7 @@ services:
- {{ websites_basepath }}/{{ website.name }}:/var/www/html/{{ website.name }}:ro - {{ websites_basepath }}/{{ website.name }}:/var/www/html/{{ website.name }}:ro
{% endif %} {% endif %}
{% endfor %} {% endfor %}
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
restart: unless-stopped restart: unless-stopped
{% endif %} {% endif %}