diff --git a/ansible/group_vars/NAS/NAS b/ansible/group_vars/NAS/NAS index 82df5cb..f5d1d25 100644 --- a/ansible/group_vars/NAS/NAS +++ b/ansible/group_vars/NAS/NAS @@ -2,19 +2,34 @@ NAS_nomad_folder: - name: openldap owner: 1001 -nas_bind_source: - - /data/data1/nomad - - /data/data1/music - - /data/data1/download - - /data/data2/serie - - /data/data3/film - - /data/data1/photo - - /data/data1/homes - - /data/data1/ebook - - nas_bind_target: "/exports" +nas_bind_source: + - dest: "{{ nas_bind_target }}/nomad" + source: /data/data1/nomad + - dest: "{{ nas_bind_target }}/music" + source: /data/data1/music + - dest: "{{ nas_bind_target }}/download" + source: /data/data1/download + - dest: "{{ nas_bind_target }}/media/serie" + source: /data/data2/serie + - dest: "{{ nas_bind_target }}/media/film" + source: /data/data3/film + - dest: "{{ nas_bind_target }}/photo" + source: /data/data1/photo + - dest: "{{ nas_bind_target }}/homes" + source: /data/data1/homes + - dest: "{{ nas_bind_target }}/ebook" + source: /data/data1/ebook + - dest: "{{ nas_bind_target }}/media/download/serie" + source: /data/data1/download/serie + - dest: "{{ nas_bind_target }}/media/download/film" + source: /data/data1/download/film + - dest: "{{ nas_bind_target }}/music/download/" + source: /data/data1/download/music + + + diff --git a/ansible/group_vars/NAS/nfs b/ansible/group_vars/NAS/nfs index 07a9b2f..d60c021 100644 --- a/ansible/group_vars/NAS/nfs +++ b/ansible/group_vars/NAS/nfs @@ -8,8 +8,7 @@ nfs_exports: - "{{ nas_bind_target }}/nomad {{nfs_cluster_list}}" - "{{ nas_bind_target }}/download {{nfs_cluster_list}}" - "{{ nas_bind_target }}/music {{nfs_cluster_list}}" - - "{{ nas_bind_target }}/film {{nfs_cluster_list}}" - - "{{ nas_bind_target }}/serie {{nfs_cluster_list}}" + - "{{ nas_bind_target }}/media {{nfs_cluster_list}}" - "{{ nas_bind_target }}/photo {{nfs_cluster_list}}" - "{{ nas_bind_target }}/homes {{nfs_cluster_list}}" - "{{ nas_bind_target }}/ebook {{nfs_cluster_list}}" diff --git a/ansible/group_vars/NAS/samba b/ansible/group_vars/NAS/samba index 9e5666c..c36856b 100644 --- a/ansible/group_vars/NAS/samba +++ b/ansible/group_vars/NAS/samba @@ -1,15 +1,10 @@ samba_passdb_backend: tdbsam samba_shares_root: /exports samba_shares: - - name: film - comment: "film" - write_list: "@NAS_film" + - name: media + comment: "media" + write_list: "@NAS_media" browseable: true - - name: serie - comment: "serie" - write_list: "@NAS_serie" - browseable: true - - name: ebook comment: "ebook" write_list: "@NAS_ebook" diff --git a/ansible/group_vars/cluster/mount b/ansible/group_vars/cluster/mount index c83a695..01822ea 100644 --- a/ansible/group_vars/cluster/mount +++ b/ansible/group_vars/cluster/mount @@ -23,22 +23,14 @@ systemd_mounts: - " " automount: "{{ env_automount }}" enabled: true - diskstation_serie: - share: "{{ nas_ip }}:{{ env_default_nfs_path }}/serie" + diskstation_media: + share: "{{ nas_ip }}:{{ env_default_nfs_path }}/media" mount: /mnt/diskstation/serie type: nfs options: - " " automount: "{{ env_automount }}" enabled: true - diskstation_film: - share: "{{ nas_ip }}:{{ env_default_nfs_path }}/film" - mount: /mnt/diskstation/film - type: nfs - options: - - " " - automount: "{{ env_automount }}" - enabled: true diskstation_ebook: share: "{{ nas_ip }}:{{ env_default_nfs_path }}/ebook" diff --git a/ansible/group_vars/staging b/ansible/group_vars/staging index 33cb29a..72f7f91 100644 --- a/ansible/group_vars/staging +++ b/ansible/group_vars/staging @@ -15,7 +15,6 @@ hosts_entries: name: diskstation.ducamps.eu env_default_nfs_path: "" -env_media_nfs_path: "{{ env_default_nfs_path }}" env_automount: true nas_ip: "nfs.service.consul" diff --git a/ansible/playbooks/nas.yml b/ansible/playbooks/nas.yml index d84cc71..a07cfde 100644 --- a/ansible/playbooks/nas.yml +++ b/ansible/playbooks/nas.yml @@ -6,29 +6,16 @@ vars: # certbot_force: true pre_tasks: - - name: Ensure base NFS directory exist - ansible.builtin.file: - path: "{{ item }}" - state: directory + - name: include task NasBind + ansible.builtin.include_tasks: + file: tasks/NasBind.yml loop: "{{ nas_bind_source }}" - become: true - - - name: Bind NAS export - ansible.posix.mount: - path: "{{ nas_bind_target }}/{{ item.split('/')[-1] }}" - src: "{{ item }}" - opts: bind - fstype: none - state: mounted - loop: "{{ nas_bind_source }}" - become: true - name: create nomad folder ansible.builtin.file: path: "{{ nas_bind_target }}/nomad/{{ item.name }}" owner: "{{ item.owner }}" state: directory loop: "{{ NAS_nomad_folder }}" - become: true roles: - role: ansible-role-nut become: true diff --git a/ansible/playbooks/tasks/NasBind.yml b/ansible/playbooks/tasks/NasBind.yml new file mode 100644 index 0000000..b6c04fd --- /dev/null +++ b/ansible/playbooks/tasks/NasBind.yml @@ -0,0 +1,13 @@ +- name: Ensure base NFS directory exist + ansible.builtin.file: + path: "{{ item.dest }}" + state: directory + become: true +- name: Bind NAS export + ansible.posix.mount: + path: "{{ item.dest }}" + src: "{{ item.source }}" + opts: bind + fstype: none + state: mounted + become: true diff --git a/nomad-job/jellyfin.nomad b/nomad-job/jellyfin.nomad index 2b71e34..ab183f1 100644 --- a/nomad-job/jellyfin.nomad +++ b/nomad-job/jellyfin.nomad @@ -93,10 +93,8 @@ job "jellyfin" { volumes = [ "/mnt/diskstation/nomad/jellyfin/config:/config", "/mnt/diskstation/nomad/jellyfin/cache:/cache", - "/mnt/diskstation/film:/film", - "/mnt/diskstation/serie:/serie", + "/mnt/diskstation/media:/media", "/mnt/diskstation/music:/music", - "/mnt/diskstation/download/:/download" ] devices = [ {