Add more flexible nfs mount definitions

Also commenting out NAS since it's down
This commit is contained in:
IamTheFij 2023-01-13 15:17:03 -08:00
parent 03fd68b4f7
commit fd92573c16
2 changed files with 71 additions and 87 deletions

View File

@ -5,6 +5,10 @@ all:
hosts:
n1.thefij:
nomad_node_role: both
nfs_mounts:
- src: 10.50.250.2:/srv/volumes
path: /srv/volumes/moxy
opts: proto=tcp,rw
nomad_unique_host_volumes:
- name: mysql-data
path: /srv/volumes/mysql
@ -19,6 +23,10 @@ all:
mode: "0755"
read_only: false
n2.thefij:
nfs_mounts:
- src: 10.50.250.2:/srv/volumes
path: /srv/volumes/moxy
opts: proto=tcp,rw
nomad_node_class: ingress
nomad_node_role: both
nomad_unique_host_volumes:

View File

@ -177,6 +177,27 @@
- name: Create NFS mounts
hosts: nomad_instances
become: true
vars:
shared_nfs_mounts: []
# - src: 192.168.2.10:/Multimedia
# path: /srv/volumes/media-read
# opts: proto=tcp,port=2049,ro
#
# - src: 192.168.2.10:/Multimedia
# path: /srv/volumes/media-write
# opts: proto=tcp,port=2049,rw
#
# - src: 192.168.2.10:/Photos
# path: /srv/volumes/photos
# opts: proto=tcp,port=2049,rw
#
# - src: 192.168.2.10:/Download
# path: /srv/volumes/download
# opts: proto=tcp,port=2049,rw
#
# - src: 192.168.2.10:/Container
# path: /srv/volumes/container
# opts: proto=tcp,port=2049,rw
tasks:
- name: Install nfs
@ -184,53 +205,14 @@
name: nfs-common
state: present
- name: Create Motioneye NFS mount
- name: Mount NFS volumes
ansible.posix.mount:
src: 192.168.2.10:/Recordings/Motioneye
path: /srv/volumes/motioneye-recordings
opts: proto=tcp,port=2049,rw
state: mounted
fstype: nfs4
- name: Create Media Library RO NFS mount
ansible.posix.mount:
src: 192.168.2.10:/Multimedia
path: /srv/volumes/media-read
opts: proto=tcp,port=2049,ro
state: mounted
fstype: nfs4
- name: Create Media Library RW NFS mount
ansible.posix.mount:
src: 192.168.2.10:/Multimedia
path: /srv/volumes/media-write
opts: proto=tcp,port=2049,rw
state: mounted
fstype: nfs4
- name: Create Photo library NFS mount
ansible.posix.mount:
src: 192.168.2.10:/Photos
path: /srv/volumes/photos
opts: proto=tcp,port=2049,rw
state: mounted
fstype: nfs4
- name: Create Download RW NFS mount
ansible.posix.mount:
src: 192.168.2.10:/Download
path: /srv/volumes/download
opts: proto=tcp,port=2049,rw
state: mounted
fstype: nfs4
- name: Create Container NAS RW NFS mount
ansible.posix.mount:
src: 192.168.2.10:/Container
path: /srv/volumes/container
opts: proto=tcp,port=2049,rw
src: "{{ item.src }}"
path: "{{ item.path }}"
opts: "{{ item.opts }}"
state: mounted
fstype: nfs4
loop: "{{ shared_nfs_mounts + (nfs_mounts | default([])) }}"
- name: Build Nomad cluster
hosts: nomad_instances
@ -238,49 +220,43 @@
become: true
vars:
shared_host_volumes:
- name: motioneye-recordings
path: /srv/volumes/motioneye-recordings
owner: "root"
group: "root"
mode: "0755"
read_only: false
- name: media-read
path: /srv/volumes/media-write
read_only: true
- name: media-write
path: /srv/volumes/media-write
owner: "root"
group: "root"
mode: "0755"
read_only: false
- name: tv-sonarr
path: "/srv/volumes/media-write/TV Shows"
owner: 1001
group: 100
mode: "0755"
read_only: false
- name: download
path: /srv/volumes/download
owner: 1001
group: 100
mode: "0755"
read_only: false
- name: nzbget-data
path: /srv/volumes/container/nzbget/config
read_only: false
- name: gitea-data
path: /srv/volumes/container/gitea
read_only: false
- name: photoprism-media
path: /srv/volumes/photos/Photoprism
read_only: false
- name: all-volumes
path: /srv/volumes
owner: "root"
group: "root"
mode: "0755"
read_only: false
shared_host_volumes: []
# - name: media-read
# path: /srv/volumes/media-write
# read_only: true
# - name: media-write
# path: /srv/volumes/media-write
# owner: "root"
# group: "root"
# mode: "0755"
# read_only: false
# - name: tv-sonarr
# path: "/srv/volumes/media-write/TV Shows"
# owner: 1001
# group: 100
# mode: "0755"
# read_only: false
# - name: download
# path: /srv/volumes/download
# owner: 1001
# group: 100
# mode: "0755"
# read_only: false
# - name: nzbget-data
# path: /srv/volumes/container/nzbget/config
# read_only: false
# - name: gitea-data
# path: /srv/volumes/container/gitea
# read_only: false
# - name: photoprism-media
# path: /srv/volumes/photos/Photoprism
# read_only: false
# - name: all-volumes
# path: /srv/volumes
# owner: "root"
# group: "root"
# mode: "0755"
# read_only: false
roles:
- name: ansible-nomad