Skip to content

Commit

Permalink
YDA-6166: only mount NFS shares if host matches
Browse files Browse the repository at this point in the history
  • Loading branch information
lwesterhof committed Feb 28, 2025
1 parent 16577f2 commit c073860
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
9 changes: 6 additions & 3 deletions environments/development/allinone/group_vars/allinone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -190,11 +190,14 @@ s3_hostname: localhost:9000
# NFS configuration
enable_nfs_resource: true
nfs_mounts:
- src: "{{ ansible_host }}:/var/nfs/Vault1_1"
- host: combined.yoda.test
src: "{{ ansible_host }}:/var/nfs/Vault1_1"
path: "/nfs/Vault1_1"
- src: "{{ ansible_host }}:/var/nfs/Vault1_2"
- host: combined.yoda.test
src: "{{ ansible_host }}:/var/nfs/Vault1_2"
path: "/nfs/Vault1_2"
- src: "{{ ansible_host }}:/var/nfs/Vault2_1"
- host: combined.yoda.test
src: "{{ ansible_host }}:/var/nfs/Vault2_1"
path: "/nfs/Vault2_1"

# Mail notifications
Expand Down
9 changes: 6 additions & 3 deletions roles/nfs_client/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@ nfs_mounts:

# Example configuration for development environment.
# nfs_mounts:
# - src: "{{ ansible_host }}:/var/nfs/Vault1_1"
# - host: combined.yoda.test
# src: "{{ ansible_host }}:/var/nfs/Vault1_1"
# path: "/nfs/Vault1_1"
# - src: "{{ ansible_host }}:/var/nfs/Vault1_2"
# - host: combined.yoda.test
# src: "{{ ansible_host }}:/var/nfs/Vault1_2"
# path: "/nfs/Vault1_2"
# - src: "{{ ansible_host }}:/var/nfs/Vault2_1"
# - host: combined.yoda.test
# src: "{{ ansible_host }}:/var/nfs/Vault2_1"
# path: "/nfs/Vault2_1"
2 changes: 2 additions & 0 deletions roles/nfs_client/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
group: irods
mode: '0755'
loop: "{{ nfs_mounts if nfs_mounts is iterable else [] }}"
when: item.host == ansible_fqdn


- name: Ensure NFS shares are mounted and present in /etc/fstab
Expand All @@ -35,3 +36,4 @@
dump: 0
passno: 0
loop: "{{ nfs_mounts if nfs_mounts is iterable else [] }}"
when: item.host == ansible_fqdn

0 comments on commit c073860

Please # to comment.