-
Notifications
You must be signed in to change notification settings - Fork 3
/
slurm-cluster-03-configure-nfs.yml
70 lines (61 loc) · 1.98 KB
/
slurm-cluster-03-configure-nfs.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
---
- name: Configure NFS
hosts:
- nfs_server
- nfs_clients
gather_facts: true
become: true
remote_user: "{{ local_ssh_remote_user }}"
tasks:
- name: Configure the NFS server
block:
- name: Format and mount the NFS data disk
ansible.builtin.import_role:
name: aeriscloud.disk
vars:
disk_additional_disks:
- disk: /dev/vdb
fstype: xfs
mount_options: defaults
mount: "{{ local_shared_folder }}"
user: root
group: root
disk_discover_aws_nvme_ebs: False
- name: Create folders "home" and "data" and "scratch" inside the NFS volume
ansible.builtin.file:
path: "{{ local_shared_folder }}/{{ item }}"
state: directory
mode: 0755
owner: root
group: root
loop:
- "home"
- "data"
- "scratch"
- name: Configure NFS exports
ansible.builtin.import_role:
name: geerlingguy.nfs
vars:
nfs_exports:
- "{{ local_shared_folder }} *(rw,async,no_root_squash)"
when: "'nfs_server' in group_names"
tags: nfs_server
- name: Add the nfs server to /etc/hosts
ansible.builtin.blockinfile:
dest: /etc/hosts
marker_begin: "BEGIN nfs-server host"
marker_end: "END nfs-server host"
block: |
{{ hostvars[groups['nfs_server'][0]]['ansible_host'] }} {{ groups['nfs_server'][0] }}
tags: nfs_clients
- name: Configure NFS clients
ansible.builtin.import_role:
name: ome.nfs_mount
vars:
nfs_share_mounts:
- path: "{{ local_shared_folder }}"
location: "{{ local_nfs_server }}:{{ local_shared_folder }}"
nfs_version: 3
nfs_mount_opts: rsize=8192,wsize=8192,timeo=14,intr
when: "'nfs_clients' in group_names"
tags: nfs_clients