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
ansible-galaxy collection install community.general
```
### Ansible Vault

View File

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

View File

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

View File

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

View File

@ -2,6 +2,10 @@
tags:
- apt
- include: timezone.yml
tags:
- timezone
- include: users.yml
tags:
- 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
volumes:
- grav_lola:/var/www/html
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
networks:
- proxy
labels:

View File

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

View File

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

View File

@ -26,6 +26,8 @@ services:
- C_FORCE_ROOT=true
volumes:
- "{{ 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
networks:
- db
@ -49,6 +51,8 @@ services:
- "{{ funkwhale_import_music_directory_host }}:{{ funkwhale_import_music_directory }}:ro"
- "static:{{ funkwhale_static_root }}"
- "frontend:{{ funkwhale_frontend }}"
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
labels:
traefik.http.routers.funkwhale_api.entrypoints: websecure
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"
- "static:{{ funkwhale_static_root }}"
- "frontend:{{ funkwhale_frontend }}"
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
labels:
traefik.http.routers.funkwhale.entrypoints: websecure
traefik.http.routers.funkwhale.rule: "Host(`{{ funkwhale_subdomain }}.{{ domain_name }}`)"
@ -84,6 +90,8 @@ services:
env_file: ./conf.env
volumes:
- redis:/data
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
networks:
- db
restart: unless-stopped
@ -95,6 +103,10 @@ services:
POSTGRES_USER: funkwhale
POSTGRES_DB: funkwhale
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:
- db:/var/lib/postgresql/data
networks:

View File

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

View File

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

View File

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

View File

@ -14,6 +14,8 @@ services:
volumes:
- {{ websites_basepath }}/{{ website.name }}:/var/www/html:ro
- {{ websites_basepath }}/{{ website.name }}.conf:/etc/nginx/conf.d/default.conf:ro
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
labels:
traefik.http.routers.{{ website.name }}.entrypoints: websecure
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
{% endif %}
{% endfor %}
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
restart: unless-stopped
{% endif %}