put nfs share in export bind

This commit is contained in:
vincent 2024-01-13 18:32:02 +01:00
parent 11fe5fb5dc
commit 6ddcc4736e
2 changed files with 27 additions and 12 deletions

View File

@ -1,15 +1,20 @@
nfs_cluster_list: "{% for server in groups['all']%}{{ hostvars[server]['ansible_default_ipv4']['address'] }}(rw,no_root_squash,async,insecure_locks,sec=sys) {%endfor%}" nfs_cluster_list: "{% for server in groups['all']%}{{ hostvars[server]['ansible_default_ipv4']['address'] }}(rw,no_root_squash,async,insecure_locks,sec=sys) {%endfor%}"
nfs_consul_service: true
nfs_bind_target: "/exports"
nfs_bind_source:
- /var/local/volume1/nomad
- /var/local/volume1/music
- /var/local/volume1/media
- /var/local/volume1/photo
- /var/local/volume1/ebook
nfs_exports: nfs_exports:
- "/var/local/volume1/nomad {{nfs_cluster_list}}" - "{{nfs_bind_target }} *(fsid=0,insecure,no_subtree_check)"
- "/var/local/volume1/music {{nfs_cluster_list}}" - "{{ nfs_bind_target }}/nomad {{nfs_cluster_list}}"
- "/var/local/volume1/media {{nfs_cluster_list}}" - "{{ nfs_bind_target }}/music {{nfs_cluster_list}}"
- "/var/local/volume1/photo {{nfs_cluster_list}}" - "{{ nfs_bind_target }}/media {{nfs_cluster_list}}"
- "/var/local/volume1/ebook {{nfs_cluster_list}}" - "{{ nfs_bind_target }}/photo {{nfs_cluster_list}}"
- "/var/local/volume1/git {{nfs_cluster_list}}" - "{{ nfs_bind_target }}/ebook {{nfs_cluster_list}}"
- "/var/local/volume1/archMirror {{nfs_cluster_list}}"
- "/var/local/volume1/homes/admin {{nfs_cluster_list}}"
- "/var/local/volume1/CardDav {{nfs_cluster_list}}"

View File

@ -1,7 +1,17 @@
--- ---
- hosts: NAS - name: NAS playbook
hosts: NAS
vars: vars:
# certbot_force: true # certbot_force: true
pre_tasks:
- name: Bind NFS export
ansible.posix.mount:
path: "{{ nfs_bind_target }}/{{ item.split('/')[-1] }}"
src: "{{ items }}"
opts: bind
fstype: none
state: mounted
loop: nfs_bind_source
roles: roles:
- role: ansible-role-nfs - role: ansible-role-nfs
become: true become: true