diff --git a/README.md b/README.md index c2730ee..b560bb2 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@ ``` pip install -r requirements.txt +ansible-galaxy collection install community.general ``` ### Ansible Vault diff --git a/inv/host_vars/chosto.me/vars.yml b/inv/host_vars/chosto.me/vars.yml index 939c28d..eaa3dcb 100644 --- a/inv/host_vars/chosto.me/vars.yml +++ b/inv/host_vars/chosto.me/vars.yml @@ -4,6 +4,7 @@ firewall_in_ports: - "{{ ssh_port }}" hostname: "{{ base_user_name }}" +timezone: Europe/Paris ssh_port: "2220" diff --git a/music.yml b/music.yml index 56ceba6..3220636 100644 --- a/music.yml +++ b/music.yml @@ -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 diff --git a/roles/base/defaults/main.yml b/roles/base/defaults/main.yml index 6195548..7279752 100644 --- a/roles/base/defaults/main.yml +++ b/roles/base/defaults/main.yml @@ -4,3 +4,5 @@ ihl_base_apt_cache_time: 3600 ihl_base_additional_groups: [] ihl_base_users: [] ihl_base_ssh_users: [] + +timezone: Europe/Paris diff --git a/roles/base/tasks/main.yml b/roles/base/tasks/main.yml index 1c0c15a..2004663 100644 --- a/roles/base/tasks/main.yml +++ b/roles/base/tasks/main.yml @@ -2,6 +2,10 @@ tags: - apt +- include: timezone.yml + tags: + - timezone + - include: users.yml tags: - users diff --git a/roles/base/tasks/timezone.yml b/roles/base/tasks/timezone.yml new file mode 100644 index 0000000..f737fd7 --- /dev/null +++ b/roles/base/tasks/timezone.yml @@ -0,0 +1,3 @@ +- name: Set correct timezone + community.general.timezone: + name: "{{ timezone }}" diff --git a/roles/grav/templates/docker-compose.yml.j2 b/roles/grav/templates/docker-compose.yml.j2 index 6f9e6de..7760d67 100644 --- a/roles/grav/templates/docker-compose.yml.j2 +++ b/roles/grav/templates/docker-compose.yml.j2 @@ -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: diff --git a/roles/hugo/templates/docker-compose.yml.j2 b/roles/hugo/templates/docker-compose.yml.j2 index 9942c99..8c153a3 100644 --- a/roles/hugo/templates/docker-compose.yml.j2 +++ b/roles/hugo/templates/docker-compose.yml.j2 @@ -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 }}`)" diff --git a/roles/lychee/templates/docker-compose.yml.j2 b/roles/lychee/templates/docker-compose.yml.j2 index f9e7cc2..122f520 100644 --- a/roles/lychee/templates/docker-compose.yml.j2 +++ b/roles/lychee/templates/docker-compose.yml.j2 @@ -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 diff --git a/roles/music/tasks/funkwhale.yml b/roles/music/tasks/main.yml similarity index 100% rename from roles/music/tasks/funkwhale.yml rename to roles/music/tasks/main.yml diff --git a/roles/music/templates/docker-compose.yml.j2 b/roles/music/templates/docker-compose.yml.j2 index 14092ba..583a110 100644 --- a/roles/music/templates/docker-compose.yml.j2 +++ b/roles/music/templates/docker-compose.yml.j2 @@ -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: diff --git a/roles/nextcloud/tasks/main.yml b/roles/nextcloud/tasks/main.yml index 7af508b..eb6c39a 100644 --- a/roles/nextcloud/tasks/main.yml +++ b/roles/nextcloud/tasks/main.yml @@ -22,4 +22,5 @@ remove_orphans: yes pull: yes recreate: smart - state: present + state: absent + ignore_errors: yes diff --git a/roles/nextcloud/templates/docker-compose.yml.j2 b/roles/nextcloud/templates/docker-compose.yml.j2 index 788e88b..297f427 100644 --- a/roles/nextcloud/templates/docker-compose.yml.j2 +++ b/roles/nextcloud/templates/docker-compose.yml.j2 @@ -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 }}`)" diff --git a/roles/traefik/templates/docker-compose.yml.j2 b/roles/traefik/templates/docker-compose.yml.j2 index 43f7629..3ee36fd 100644 --- a/roles/traefik/templates/docker-compose.yml.j2 +++ b/roles/traefik/templates/docker-compose.yml.j2 @@ -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 diff --git a/roles/web/templates/docker-compose.yml.j2 b/roles/web/templates/docker-compose.yml.j2 index fdbddfd..58b589f 100644 --- a/roles/web/templates/docker-compose.yml.j2 +++ b/roles/web/templates/docker-compose.yml.j2 @@ -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 %}