-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
YDA-6166: experimental support for NFS resources
- Loading branch information
1 parent
97b18c1
commit 16577f2
Showing
12 changed files
with
194 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--- | ||
# copyright Utrecht University | ||
|
||
nfs_mounts: | ||
|
||
# Example configuration for development environment. | ||
# nfs_mounts: | ||
# - src: "{{ ansible_host }}:/var/nfs/Vault1_1" | ||
# path: "/nfs/Vault1_1" | ||
# - src: "{{ ansible_host }}:/var/nfs/Vault1_2" | ||
# path: "/nfs/Vault1_2" | ||
# - src: "{{ ansible_host }}:/var/nfs/Vault2_1" | ||
# path: "/nfs/Vault2_1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--- | ||
# copyright Utrecht University | ||
|
||
galaxy_info: | ||
author: Leonidas Triantafyllou | ||
description: Install NFS client | ||
license: GPLv3 | ||
min_ansible_version: '2.16' | ||
platforms: | ||
- name: EL | ||
version: 9 | ||
- name: Ubuntu | ||
version: noble |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
--- | ||
# copyright Utrecht University | ||
|
||
- name: Ensure NFS utilities are installed (Debian) | ||
ansible.builtin.package: | ||
name: nfs-common | ||
state: present | ||
when: ansible_os_family == 'Debian' | ||
|
||
|
||
- name: Ensure NFS utilities are installed (RedHat) | ||
ansible.builtin.package: | ||
name: nfs-utils | ||
state: present | ||
when: ansible_os_family == 'RedHat' | ||
|
||
|
||
- name: Ensure NFS mount points exist | ||
ansible.builtin.file: | ||
path: "{{ item.path }}" | ||
state: directory | ||
owner: irods | ||
group: irods | ||
mode: '0755' | ||
loop: "{{ nfs_mounts if nfs_mounts is iterable else [] }}" | ||
|
||
|
||
- name: Ensure NFS shares are mounted and present in /etc/fstab | ||
ansible.posix.mount: | ||
path: "{{ item.path }}" | ||
src: "{{ item.src }}" | ||
fstype: nfs | ||
opts: rw,sync,hard,intr | ||
state: mounted | ||
dump: 0 | ||
passno: 0 | ||
loop: "{{ nfs_mounts if nfs_mounts is iterable else [] }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
# copyright Utrecht University | ||
|
||
nfs_export_base: "/var/nfs" | ||
|
||
# NFS exports for development environment. | ||
nfs_exports: | ||
- "{{ nfs_export_base }}/Vault1_1" | ||
- "{{ nfs_export_base }}/Vault1_2" | ||
- "{{ nfs_export_base }}/Vault2_1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
# copyright Utrecht University | ||
|
||
- name: Reload NFS | ||
ansible.builtin.command: 'exportfs -ra' | ||
changed_when: false | ||
when: nfs_exports | length > 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--- | ||
# copyright Utrecht University | ||
|
||
galaxy_info: | ||
author: Leonidas Triantafyllou | ||
description: Install NFS server | ||
license: GPLv3 | ||
min_ansible_version: '2.16' | ||
platforms: | ||
- name: EL | ||
version: 9 | ||
- name: Ubuntu | ||
version: noble |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
--- | ||
# copyright Utrecht University | ||
|
||
- name: Include OS-specific variables | ||
ansible.builtin.include_vars: "{{ ansible_os_family }}.yml" | ||
|
||
|
||
- name: Ensure NFS server is installed (Debian) | ||
ansible.builtin.package: | ||
name: nfs-kernel-server | ||
state: present | ||
when: ansible_os_family == 'Debian' | ||
|
||
|
||
- name: Ensure NFS utilities are installed (RedHat) | ||
ansible.builtin.package: | ||
name: nfs-utils | ||
state: present | ||
when: ansible_os_family == 'RedHat' | ||
|
||
|
||
- name: Ensure NFS share directories exist | ||
ansible.builtin.file: | ||
path: /var/nfs | ||
state: directory | ||
owner: irods | ||
group: irods | ||
mode: '0755' | ||
|
||
|
||
- name: Ensure NFS share directories exist | ||
ansible.builtin.file: | ||
path: "{{ item }}" | ||
state: directory | ||
owner: irods | ||
group: irods | ||
mode: '0755' | ||
loop: "{{ nfs_exports if nfs_exports is iterable else [] }}" | ||
|
||
|
||
- name: Ensure NFS exports are configured | ||
ansible.builtin.template: | ||
src: exports.j2 | ||
dest: /etc/exports | ||
owner: root | ||
group: root | ||
mode: '0644' | ||
notify: Reload NFS | ||
when: nfs_exports is iterable | ||
|
||
|
||
- name: Ensure NFS deamon is running | ||
ansible.builtin.service: | ||
name: "{{ nfs_server_daemon }}" | ||
state: started | ||
enabled: true | ||
when: nfs_exports is iterable | ||
|
||
|
||
- name: Flush handlers to apply NFS exports | ||
ansible.builtin.meta: flush_handlers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# /etc/exports: the access control list for filesystems which may be exported | ||
# to NFS clients. See exports(5). | ||
# | ||
# Example for NFSv2 and NFSv3: | ||
# /srv/homes hostname1(rw,sync,no_subtree_check) hostname2(ro,sync,no_subtree_check) | ||
# | ||
# Example for NFSv4: | ||
# /srv/nfs4 gss/krb5i(rw,sync,fsid=0,crossmnt,no_subtree_check) | ||
# /srv/nfs4/homes gss/krb5i(rw,sync,no_subtree_check) | ||
# | ||
{% for export in nfs_exports %} | ||
{{ export }} *(rw,sync,no_subtree_check) | ||
{% endfor %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
--- | ||
# copyright Utrecht University | ||
|
||
nfs_server_daemon: nfs-kernel-server |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
--- | ||
# copyright Utrecht University | ||
|
||
nfs_server_daemon: nfs-server |