From 3391dfa41cd46fe5c7af4e70c971b1f8ecf112ec Mon Sep 17 00:00:00 2001 From: Sam Al-Sapti Date: Tue, 27 Jun 2023 12:44:10 +0200 Subject: [PATCH] Move all data but Emby storage to SSD storage --- roles/docker_services/defaults/main.yml | 7 +++++-- roles/docker_services/tasks/services.yml | 9 +++++++-- roles/docker_services/tasks/services/emby.yml | 16 ++++++++-------- roles/docker_services/tasks/services/monerod.yml | 14 ++++++++------ 4 files changed, 28 insertions(+), 18 deletions(-) diff --git a/roles/docker_services/defaults/main.yml b/roles/docker_services/defaults/main.yml index 1b81936..f657d82 100644 --- a/roles/docker_services/defaults/main.yml +++ b/roles/docker_services/defaults/main.yml @@ -1,7 +1,8 @@ # vim: ft=yaml.ansible --- base_domain: sapti.me -base_volume: "{{ hdd_mount_point }}/apps" +base_volume: "{{ ssd_mount_point }}/apps" +mass_data_volume: "{{ hdd_mount_point }}/apps" services: caddy: @@ -17,10 +18,12 @@ services: emby: domain: watch.{{ base_domain }} volume: "{{ base_volume }}/emby" + data_volume: "{{ mass_data_volume }}/emby" version: latest monerod: domain: xmr.{{ base_domain }} + volume: "{{ base_volume }}/monerod" version: latest nextcloud: @@ -57,7 +60,7 @@ sender_domains: backup_volumes: - "{{ services.caddy.volume }}:/mnt/volumes/caddy:ro" - "{{ services.postfix.volume }}:/mnt/volumes/postfix:ro" - - "{{ services.emby.volume }}/programdata:/mnt/volumes/emby/programdata:ro" + - "{{ services.emby.volume }}:/mnt/volumes/emby:ro" - "{{ services.nextcloud.volume }}:/mnt/volumes/nextcloud:ro" - "{{ services.pihole.volume }}:/mnt/volumes/pi-hole:ro" - "{{ services.wireguard.volume }}:/mnt/volumes/wireguard:ro" diff --git a/roles/docker_services/tasks/services.yml b/roles/docker_services/tasks/services.yml index df27bc3..b926180 100644 --- a/roles/docker_services/tasks/services.yml +++ b/roles/docker_services/tasks/services.yml @@ -16,12 +16,17 @@ gateway: 172.18.0.1 state: present -- name: Create base directory for Docker volumes +- name: Create base directories for Docker volumes ansible.builtin.file: - name: "{{ base_volume }}" + name: "{{ volume }}" owner: root mode: u=rwx,g=rx,o=rx state: directory + loop: + - "{{ base_volume }}" + - "{{ mass_data_volume }}" + loop_control: + loop_var: volume - name: Deploy services ansible.builtin.include_tasks: services/{{ item.key }}.yml diff --git a/roles/docker_services/tasks/services/emby.yml b/roles/docker_services/tasks/services/emby.yml index 2db06dd..e5287c7 100644 --- a/roles/docker_services/tasks/services/emby.yml +++ b/roles/docker_services/tasks/services/emby.yml @@ -2,20 +2,20 @@ --- - name: Create Emby volume directories ansible.builtin.file: - name: "{{ services.emby.volume }}/{{ dir }}" - owner: "{{ ansible_user }}" + name: "{{ dir }}" + owner: '1000' mode: u=rwx,g=rx,o=rx state: directory loop: - - programdata - - tvshows - - movies + - "{{ services.emby.volume }}/programdata" + - "{{ services.emby.data_volume }}/tvshows" + - "{{ services.emby.data_volume }}/movies" loop_control: loop_var: dir - name: Deploy Emby Docker container community.docker.docker_container: - name: emby_app + name: emby state: "{{ 'absent' if stop is defined and stop else 'started' }}" restart: "{{ stop is undefined or not stop }}" image: emby/embyserver_arm64v8:{{ services.emby.version }} @@ -29,7 +29,7 @@ - emby volumes: - "{{ services.emby.volume }}/programdata:/config:rw" - - "{{ services.emby.volume }}/tvshows:/mnt/share1:rw" - - "{{ services.emby.volume }}/movies:/mnt/share2:rw" + - "{{ services.emby.data_volume }}/tvshows:/mnt/share1:rw" + - "{{ services.emby.data_volume }}/movies:/mnt/share2:rw" devices: - /dev/vchiq:/dev/vchiq # MMAL/OMX on Raspberry Pi diff --git a/roles/docker_services/tasks/services/monerod.yml b/roles/docker_services/tasks/services/monerod.yml index 7dd81c6..0bea3da 100644 --- a/roles/docker_services/tasks/services/monerod.yml +++ b/roles/docker_services/tasks/services/monerod.yml @@ -1,13 +1,15 @@ # vim: ft=yaml.ansible --- -- name: Create Docker volume for Monero blockchain data - community.docker.docker_volume: - volume_name: monerod-node-blockchain - state: present +- name: Create Monero node volume directory + ansible.builtin.file: + name: "{{ services.monerod.volume }}" + owner: '1000' + mode: u=rwx,g=rx,o=rx + state: directory - name: Deploy Monero node Docker container community.docker.docker_container: - name: monerod_node + name: monerod state: "{{ 'absent' if stop is defined and stop else 'started' }}" restart: "{{ stop is undefined or not stop }}" image: sethsimmons/simple-monerod:{{ services.monerod.version }} @@ -18,6 +20,6 @@ aliases: - monerod volumes: - - monerod-node-blockchain:/home/monero/.bitmonero:rw + - "{{ services.monerod.volume }}:/home/monero/.bitmonero:rw" published_ports: - 18080:18080/tcp