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: hosts:
n1.thefij: n1.thefij:
nomad_node_role: both 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: nomad_unique_host_volumes:
- name: mysql-data - name: mysql-data
path: /srv/volumes/mysql path: /srv/volumes/mysql
@ -19,6 +23,10 @@ all:
mode: "0755" mode: "0755"
read_only: false read_only: false
n2.thefij: 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_class: ingress
nomad_node_role: both nomad_node_role: both
nomad_unique_host_volumes: nomad_unique_host_volumes:

View File

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