From a303bed27f6a771c4ed03c72fb7274e069bbbdc3 Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Sat, 26 Sep 2020 21:15:44 +0100 Subject: [PATCH] Define app data dir in variable --- ansible/group_vars/all/directories.yml | 1 + ansible/roles/gitlab/files/docker-compose.yml | 16 ++++++++-------- ansible/roles/gitlab/tasks/main.yml | 2 +- ansible/roles/grafana/files/docker-compose.yml | 2 +- .../files/calibre/docker-compose.yml | 2 +- .../files/jellyfin/docker-compose.yml | 2 +- .../files/synapse/docker-compose.yml | 4 ++-- .../files/torrent/docker-compose.yml | 2 +- .../files/tt-rss/docker-compose.yml | 4 ++-- .../files/wallabag/docker-compose.yml | 4 ++-- ansible/roles/intersect_docker/tasks/synapse.yml | 2 +- ansible/roles/intersect_docker/tasks/tt-rss.yml | 2 +- ansible/roles/scrutiny/files/docker-compose.yml | 4 ++-- 13 files changed, 24 insertions(+), 23 deletions(-) diff --git a/ansible/group_vars/all/directories.yml b/ansible/group_vars/all/directories.yml index 2610249..558e4e5 100644 --- a/ansible/group_vars/all/directories.yml +++ b/ansible/group_vars/all/directories.yml @@ -1 +1,2 @@ traefik_influx_db_dir: ./influxdb +app_data_dir: /mnt/tank/app-data diff --git a/ansible/roles/gitlab/files/docker-compose.yml b/ansible/roles/gitlab/files/docker-compose.yml index a9e88ba..54e1bc0 100644 --- a/ansible/roles/gitlab/files/docker-compose.yml +++ b/ansible/roles/gitlab/files/docker-compose.yml @@ -12,9 +12,9 @@ services: {% endfilter %} volumes: - - /mnt/tank/app-data/gitlab/config:/etc/gitlab - - /mnt/tank/app-data/gitlab/data:/var/opt/gitlab - - /mnt/tank/app-data/gitlab/pages:/mnt/pages + - "{{ app_data_dir }}/gitlab/config:/etc/gitlab" + - "{{ app_data_dir }}/gitlab/data:/var/opt/gitlab" + - "{{ app_data_dir }}/gitlab/pages:/mnt/pages" tmpfs: - /var/log/gitlab restart: unless-stopped @@ -53,8 +53,8 @@ services: - PGID=998 restart: unless-stopped volumes: - - /mnt/tank/app-data/gitlab/pages:/mnt/pages:ro - - /mnt/tank/app-data/gitlab/lsyncd/lsyncd.lua:/config/lsyncd.lua:ro - - /mnt/tank/app-data/gitlab/lsyncd/id_ed25519.pub:/config/.ssh/id_ed25519.pub - - /mnt/tank/app-data/gitlab/lsyncd/id_ed25519:/config/.ssh/id_ed25519 - - /mnt/tank/app-data/gitlab/lsyncd/known_hosts:/config/.ssh/known_hosts + - "{{ app_data_dir }}/gitlab/pages:/mnt/pages:ro" + - "{{ app_data_dir }}/gitlab/lsyncd/lsyncd.lua:/config/lsyncd.lua:ro" + - "{{ app_data_dir }}/gitlab/lsyncd/id_ed25519.pub:/config/.ssh/id_ed25519.pub" + - "{{ app_data_dir }}/gitlab/lsyncd/id_ed25519:/config/.ssh/id_ed25519" + - "{{ app_data_dir }}/gitlab/lsyncd/known_hosts:/config/.ssh/known_hosts" diff --git a/ansible/roles/gitlab/tasks/main.yml b/ansible/roles/gitlab/tasks/main.yml index fe8228d..1a53ce9 100644 --- a/ansible/roles/gitlab/tasks/main.yml +++ b/ansible/roles/gitlab/tasks/main.yml @@ -19,7 +19,7 @@ - name: Install lsyncd config template: src: files/lsyncd.lua - dest: /mnt/tank/app-data/gitlab/lsyncd/lsyncd.lua + dest: "{{ app_data_dir }}/gitlab/lsyncd/lsyncd.lua" mode: "{{ docker_compose_file_mask }}" owner: "998" notify: restart gitlab diff --git a/ansible/roles/grafana/files/docker-compose.yml b/ansible/roles/grafana/files/docker-compose.yml index d27d4c5..f07b4e9 100644 --- a/ansible/roles/grafana/files/docker-compose.yml +++ b/ansible/roles/grafana/files/docker-compose.yml @@ -9,7 +9,7 @@ services: - GF_RENDERING_SERVER_URL=http://renderer:8081/render - GF_RENDERING_CALLBACK_URL=http://grafana:3000/ volumes: - - /mnt/tank/app-data/grafana:/var/lib/grafana + - "{{ app_data_dir }}/grafana:/var/lib/grafana" restart: unless-stopped depends_on: - db diff --git a/ansible/roles/intersect_docker/files/calibre/docker-compose.yml b/ansible/roles/intersect_docker/files/calibre/docker-compose.yml index b2df88e..20bea7a 100644 --- a/ansible/roles/intersect_docker/files/calibre/docker-compose.yml +++ b/ansible/roles/intersect_docker/files/calibre/docker-compose.yml @@ -8,7 +8,7 @@ services: - TZ=Europe/London restart: unless-stopped volumes: - - /mnt/tank/app-data/calibre:/config + - "{{ app_data_dir }}/calibre:/config" - /srv/nextcloud-data/data/jake/files/EBooks:/books:ro labels: - traefik.enable=true diff --git a/ansible/roles/intersect_docker/files/jellyfin/docker-compose.yml b/ansible/roles/intersect_docker/files/jellyfin/docker-compose.yml index 2270a2a..33fc4e2 100644 --- a/ansible/roles/intersect_docker/files/jellyfin/docker-compose.yml +++ b/ansible/roles/intersect_docker/files/jellyfin/docker-compose.yml @@ -8,7 +8,7 @@ services: - PGID={{ docker_user.id }} - TZ=Europe/London volumes: - - /mnt/tank/app-data/jellyfin:/config + - "{{ app_data_dir }}/jellyfin:/config" - /mnt/media/TV:/mnt/TV - /mnt/media/Movies:/mnt/Movies - /mnt/scratch/transcodes:/config/data/transcodes diff --git a/ansible/roles/intersect_docker/files/synapse/docker-compose.yml b/ansible/roles/intersect_docker/files/synapse/docker-compose.yml index decfa9d..c33cb64 100644 --- a/ansible/roles/intersect_docker/files/synapse/docker-compose.yml +++ b/ansible/roles/intersect_docker/files/synapse/docker-compose.yml @@ -11,8 +11,8 @@ services: - UID=0 - GID=0 volumes: - - /mnt/tank/app-data/synapse/homeserver.yaml:/etc/homeserver.yaml - - /mnt/tank/app-data/synapse:/data + - "{{ app_data_dir }}/synapse/homeserver.yaml:/etc/homeserver.yaml" + - "{{ app_data_dir }}/synapse:/data" depends_on: - db expose: diff --git a/ansible/roles/intersect_docker/files/torrent/docker-compose.yml b/ansible/roles/intersect_docker/files/torrent/docker-compose.yml index b9aeb82..e20f737 100644 --- a/ansible/roles/intersect_docker/files/torrent/docker-compose.yml +++ b/ansible/roles/intersect_docker/files/torrent/docker-compose.yml @@ -7,7 +7,7 @@ services: - PGID={{ docker_user.id }} - TZ=Europe/London volumes: - - /mnt/tank/app-data/deluge:/config + - "{{ app_data_dir }}/deluge:/config" - /mnt/scratch/deluge:/downloads ports: - 8112:8112 diff --git a/ansible/roles/intersect_docker/files/tt-rss/docker-compose.yml b/ansible/roles/intersect_docker/files/tt-rss/docker-compose.yml index 01a88ea..4d10baf 100644 --- a/ansible/roles/intersect_docker/files/tt-rss/docker-compose.yml +++ b/ansible/roles/intersect_docker/files/tt-rss/docker-compose.yml @@ -8,8 +8,8 @@ services: - PGID={{ docker_user.id }} - TZ=Europe/London volumes: - - /mnt/tank/app-data/tt-rss/config.php:/config/config.php:ro - - /mnt/tank/app-data/tt-rss/feed-icons:/config/feed-icons + - "{{ app_data_dir }}/tt-rss/config.php:/config/config.php:ro" + - "{{ app_data_dir }}/tt-rss/feed-icons:/config/feed-icons" restart: unless-stopped labels: - traefik.enable=true diff --git a/ansible/roles/intersect_docker/files/wallabag/docker-compose.yml b/ansible/roles/intersect_docker/files/wallabag/docker-compose.yml index 7c195c0..467e3cf 100644 --- a/ansible/roles/intersect_docker/files/wallabag/docker-compose.yml +++ b/ansible/roles/intersect_docker/files/wallabag/docker-compose.yml @@ -8,8 +8,8 @@ services: - SYMFONY__ENV__SECRET={{ wallabag_secret }} - SYMFONY__ENV__DOMAIN_NAME=https://wallabag.jakehoward.tech volumes: - - /mnt/tank/app-data/wallabag/data:/var/www/wallabag/data - - /mnt/tank/app-data/wallabag/images:/var/www/wallabag/images + - "{{ app_data_dir }}/wallabag/data:/var/www/wallabag/data" + - "{{ app_data_dir }}/wallabag/images:/var/www/wallabag/images" labels: - traefik.enable=true - traefik.http.routers.wallabag.rule=Host(`wallabag.jakehoward.tech`) diff --git a/ansible/roles/intersect_docker/tasks/synapse.yml b/ansible/roles/intersect_docker/tasks/synapse.yml index 2e572a7..f39b89c 100644 --- a/ansible/roles/intersect_docker/tasks/synapse.yml +++ b/ansible/roles/intersect_docker/tasks/synapse.yml @@ -22,7 +22,7 @@ - name: Install synapse config template: src: files/synapse/homeserver.yml - dest: /mnt/tank/app-data/synapse/homeserver.yaml + dest: "{{ app_data_dir }}/synapse/homeserver.yaml" mode: "{{ docker_compose_file_mask }}" owner: "{{ docker_user.name }}" register: homeserver_config diff --git a/ansible/roles/intersect_docker/tasks/tt-rss.yml b/ansible/roles/intersect_docker/tasks/tt-rss.yml index 4f0c1dc..a8c550d 100644 --- a/ansible/roles/intersect_docker/tasks/tt-rss.yml +++ b/ansible/roles/intersect_docker/tasks/tt-rss.yml @@ -19,7 +19,7 @@ - name: Install tt-rss config template: src: files/tt-rss/config.php - dest: /mnt/tank/app-data/tt-rss/config.php + dest: "{{ app_data_dir }}/tt-rss/config.php" mode: "{{ docker_compose_file_mask }}" owner: "{{ docker_user.name }}" register: config_file diff --git a/ansible/roles/scrutiny/files/docker-compose.yml b/ansible/roles/scrutiny/files/docker-compose.yml index e65c701..570f6a3 100644 --- a/ansible/roles/scrutiny/files/docker-compose.yml +++ b/ansible/roles/scrutiny/files/docker-compose.yml @@ -6,7 +6,7 @@ services: ports: - "{{ wireguard.clients[ansible_fqdn].ip }}:7278:8080" volumes: - - /mnt/tank/app-data/scrutiny/:/config + - "{{ app_data_dir }}/scrutiny/:/config" environment: - SCRUTINY_WEB=true - PUID={{ docker_user.id }} @@ -19,7 +19,7 @@ services: volumes: - /dev/disk:/dev/disk - /run/udev:/run/udev:ro - - /mnt/tank/app-data/scrutiny/:/config + - "{{ app_data_dir }}/scrutiny/:/config" environment: - SCRUTINY_COLLECTOR=true - SCRUTINY_API_ENDPOINT=http://web:8080