diff --git a/config/ansible/inventory.ini b/config/ansible/inventory.ini index cca462a..2606faa 100644 --- a/config/ansible/inventory.ini +++ b/config/ansible/inventory.ini @@ -6,4 +6,3 @@ mennos-desktop ansible_connection=local mennos-server ansible_connection=local mennos-hobbypc ansible_connection=local mennos-vm ansible_connection=local -mennos-cloud-server ansible_connection=local \ No newline at end of file diff --git a/config/ansible/playbook.yml b/config/ansible/playbook.yml index 0e5d2da..8614168 100644 --- a/config/ansible/playbook.yml +++ b/config/ansible/playbook.yml @@ -15,4 +15,4 @@ - name: Include server tasks ansible.builtin.import_tasks: tasks/servers/server.yml - when: hostname in ['mennos-server', 'mennos-hobbypc', 'mennos-vm', 'mennos-cloud-server'] + when: hostname in ['mennos-server', 'mennos-hobbypc', 'mennos-vm'] diff --git a/config/ansible/tasks/global/symlinks.yml b/config/ansible/tasks/global/symlinks.yml index edcf69e..7360955 100644 --- a/config/ansible/tasks/global/symlinks.yml +++ b/config/ansible/tasks/global/symlinks.yml @@ -30,7 +30,6 @@ mennos-server: "$DOTFILES_PATH/config/git/gitconfig.mennos-server" mennos-vm: "$DOTFILES_PATH/config/git/gitconfig.mennos-server" mennos-hobbypc: "$DOTFILES_PATH/config/git/gitconfig.linux" - mennos-cloud-server: "$DOTFILES_PATH/config/git/gitconfig.linux" - name: Create SSH authorized_keys symlink ansible.builtin.file: @@ -46,4 +45,3 @@ mennos-server: "$DOTFILES_PATH/config/ssh/authorized_keys/mennos-server" mennos-vm: "$DOTFILES_PATH/config/ssh/authorized_keys/mennos-server" mennos-hobbypc: "$DOTFILES_PATH/config/ssh/authorized_keys/mennos-hobbypc" - mennos-cloud-server: "$DOTFILES_PATH/config/ssh/authorized_keys/mennos-server" diff --git a/config/ansible/tasks/servers/server.yml b/config/ansible/tasks/servers/server.yml index d701e58..3006e15 100644 --- a/config/ansible/tasks/servers/server.yml +++ b/config/ansible/tasks/servers/server.yml @@ -7,10 +7,14 @@ state: present become: true + - name: Include ZFS tasks + ansible.builtin.include_tasks: zfs.yml + when: ansible_hostname == "mennos-server" + - name: Include services tasks ansible.builtin.include_tasks: services/services.yml vars: - hoarder_enabled: true - golink_enabled: true + hoarder_enabled: false + golink_enabled: false immich_enabled: false - when: ansible_hostname == "mennos-cloud-server" + when: ansible_hostname == "mennos-server" diff --git a/config/ansible/tasks/servers/services/golink/golink.yml b/config/ansible/tasks/servers/services/golink/golink.yml index caff925..05ff0c8 100644 --- a/config/ansible/tasks/servers/services/golink/golink.yml +++ b/config/ansible/tasks/servers/services/golink/golink.yml @@ -2,7 +2,7 @@ block: - name: Set GoLink directories ansible.builtin.set_fact: - golink_data_dir: "/mnt/storage-box/services/golink" + golink_data_dir: "/mnt/services/golink" golink_service_dir: "{{ ansible_env.HOME }}/services/golink" - name: Create GoLink directories diff --git a/config/ansible/tasks/servers/services/hoarder/hoarder.yml b/config/ansible/tasks/servers/services/hoarder/hoarder.yml index b5a8090..cb06689 100644 --- a/config/ansible/tasks/servers/services/hoarder/hoarder.yml +++ b/config/ansible/tasks/servers/services/hoarder/hoarder.yml @@ -2,7 +2,7 @@ block: - name: Set Hoarder directories ansible.builtin.set_fact: - hoarder_data_dir: "/mnt/storage-box/services/hoarder" + hoarder_data_dir: "/mnt/services/hoarder" hoarder_service_dir: "{{ ansible_env.HOME }}/services/hoarder" - name: Create Hoarder directories diff --git a/config/ansible/tasks/servers/services/immich/docker-compose.yml.j2 b/config/ansible/tasks/servers/services/immich/docker-compose.yml.j2 index 91e4094..82a31fe 100644 --- a/config/ansible/tasks/servers/services/immich/docker-compose.yml.j2 +++ b/config/ansible/tasks/servers/services/immich/docker-compose.yml.j2 @@ -3,7 +3,7 @@ services: server: image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release} volumes: - - {{ immich_data_dir }}/upload:/usr/src/app/upload + - {{ immich_data_dir }}:/usr/src/app/upload - /etc/localtime:/etc/localtime:ro env_file: - .env @@ -48,7 +48,7 @@ services: POSTGRES_INITDB_ARGS: '--data-checksums' volumes: # Do not edit the next line. If you want to change the database storage location on your system, edit the value of DB_DATA_LOCATION in the .env file - - {{ immich_data_dir }}/db:/var/lib/postgresql/data + - {{ immich_database_dir }}:/var/lib/postgresql/data healthcheck: test: pg_isready --dbname='${DB_DATABASE_NAME}' --username='${DB_USERNAME}' || exit 1; Chksum="$$(psql --dbname='${DB_DATABASE_NAME}' --username='${DB_USERNAME}' --tuples-only --no-align --command='SELECT COALESCE(SUM(checksum_failures), 0) FROM pg_stat_database')"; echo "checksum failure count is $$Chksum"; [ "$$Chksum" = '0' ] || exit 1 interval: 5m diff --git a/config/ansible/tasks/servers/services/immich/immich.yml b/config/ansible/tasks/servers/services/immich/immich.yml index 2917863..85df013 100644 --- a/config/ansible/tasks/servers/services/immich/immich.yml +++ b/config/ansible/tasks/servers/services/immich/immich.yml @@ -2,7 +2,8 @@ block: - name: Set Immich directories ansible.builtin.set_fact: - immich_data_dir: "/mnt/storage-box/services/immich" + immich_data_dir: "/mnt/photos/immich-library" + immich_database_dir: "/mnt/services/immich/data/postgres" immich_service_dir: "{{ ansible_env.HOME }}/services/immich" - name: Create Immich directories diff --git a/config/ansible/tasks/servers/zfs.yml b/config/ansible/tasks/servers/zfs.yml new file mode 100644 index 0000000..9175331 --- /dev/null +++ b/config/ansible/tasks/servers/zfs.yml @@ -0,0 +1,56 @@ +- name: Install ZFS + ansible.builtin.package: + name: + - zfsutils-linux + become: true + +- name: Ensure ZFS kernel module is loaded + ansible.builtin.command: modprobe zfs + become: true + +- name: Create mount points + ansible.builtin.file: + path: "{{ item }}" + state: directory + mode: "0755" + owner: menno + group: users + with_items: + - /mnt/ISOs + - /mnt/VMs + - /mnt/ai + - /mnt/astrophotography + - /mnt/audiobooks + - /mnt/backups/photos + - /mnt/backups/services + - /mnt/downloads + - /mnt/movies + - /mnt/music + - /mnt/old_backups + - /mnt/photos + - /mnt/services + - /mnt/stash + - /mnt/tvshows + +- name: Mount ZFS datasets + mount: + path: "{{ item.path }}" + src: "{{ item.src }}" + fstype: zfs + state: mounted + with_items: + - { path: /mnt/ISOs, src: datapool/isos } + - { path: /mnt/VMs, src: datapool/vms } + - { path: /mnt/ai, src: datapool/ai } + - { path: /mnt/astrophotography, src: datapool/astro } + - { path: /mnt/audiobooks, src: datapool/audiobooks } + - { path: /mnt/backups/photos, src: backup/photos-duplicati } + - { path: /mnt/backups/services, src: backup/services-duplicati } + - { path: /mnt/downloads, src: datapool/downloads } + - { path: /mnt/movies, src: datapool/movies } + - { path: /mnt/music, src: datapool/music } + - { path: /mnt/old_backups, src: datapool/old_backups } + - { path: /mnt/photos, src: datapool/photos } + - { path: /mnt/services, src: datapool/services } + - { path: /mnt/stash, src: datapool/stash } + - { path: /mnt/tvshows, src: datapool/tv_shows } diff --git a/config/home-manager/flake.nix b/config/home-manager/flake.nix index 7153963..7b213fa 100644 --- a/config/home-manager/flake.nix +++ b/config/home-manager/flake.nix @@ -92,16 +92,6 @@ hostname = "mennos-hobbypc"; }; }; - - "mennos-cloud-server" = home-manager.lib.homeManagerConfiguration { - inherit pkgs; - modules = [ ./home.nix ]; - extraSpecialArgs = { - inherit pkgs pkgs-unstable; - isServer = true; - hostname = "mennos-cloud-server"; - }; - }; }; }; }