Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/nfs #472

Merged
merged 5 commits into from
Sep 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions cluster.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@

- import_playbook: single_group_playbooks/ldap_server.yml

- import_playbook: single_group_playbooks/nfs_server.yml

- import_playbook: single_group_playbooks/cluster_part2.yml

- import_playbook: single_group_playbooks/sys_admin_interface.yml
Expand Down
10 changes: 10 additions & 0 deletions group_vars/compute_vm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
volumes:
- mount_point: '/local'
device: '/dev/vdb'
mounted_owner: root
mounted_group: root
mounted_mode: '0755'
mount_options: 'rw,relatime'
type: ext4
...
60 changes: 0 additions & 60 deletions group_vars/wingedhelix_cluster/secrets.yml.2021-09-13T18:30:42

This file was deleted.

5 changes: 3 additions & 2 deletions group_vars/wingedhelix_cluster/vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,11 @@ regular_users:
#
# Shared storage related variables
#
lustre_client_networks: 'tcp11(vlan???.lustre),tcp12(vlan???.lustre)'
#lustre_client_networks: 'tcp11(vlan???.lustre),tcp12(vlan???.lustre)'
pfs_mounts: [
{ pfs: 'umcgst12',
source: '', # this is going to be filled when we have shared NFS server
device: '/dev/vdb',
source: 'lookup nfs_server ip address in storage VLAN',
type: 'nfs4', # checked with cat /proc/filesystem
rw_options: 'defaults,_netdev,flock',
ro_options: 'defaults,_netdev,ro' },
Expand Down
4 changes: 2 additions & 2 deletions roles/lustre_client/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
# We cannot define a default for lustre_client_networks here;
# Always configure lustre_client_networks in group_vars/[group]/vars.yml
#
#lustre_client_networks: 'tcp11(vlanMISSING.lustre),tcp12(vlanMISSING.lustre)'
...
# lustre_client_networks: 'tcp11(vlanMISSING.lustre),tcp12(vlanMISSING.lustre)'
...
3 changes: 2 additions & 1 deletion roles/lustre_client/tasks/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@
become: true
notify: reboot

- meta: flush_handlers
- name: Flush handlers
meta: flush_handlers

- name: Install the Lustre client.
yum:
Expand Down
24 changes: 14 additions & 10 deletions roles/mount_volume/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
---
volumes:
- mount_point: '/local'
device: '/dev/vdb'
mounted_owner: root
mounted_group: root
mounted_mode: '0755'
mount_options: 'rw,relatime'
type: ext4
...
#
# Example data structure used by the mount_volume role.
#
# ---
# volumes:
# - mount_point: '/local'
# device: '/dev/vdb'
# mounted_owner: root
# mounted_group: root
# mounted_mode: '0755'
# mount_options: 'rw,relatime'
# type: ext4
# ...
#
15 changes: 15 additions & 0 deletions roles/mount_volume/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
---
- name: 'Compile list of volumes to mount for NFS servers.'
ansible.builtin.set_fact:
volumes: "{{ volumes | default([]) + [ volume ] }}"
vars:
volume:
mount_point: "/mnt/{{ item.pfs }}"
device: "{{ item.device }}"
mounted_owner: root
mounted_group: root
mounted_mode: '0755'
mount_options: 'rw,relatime'
type: ext4
when: inventory_hostname in groups['nfs_server'] | default([])
with_items: "{{ pfs_mounts | selectattr('type', 'search', 'nfs') | selectattr('device', 'defined') | list }}"

- name: 'Check the mount point.'
command: "mountpoint {{ item.mount_point }}"
register: mount_point_status
Expand Down
7 changes: 7 additions & 0 deletions roles/nfs_client/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
- name: Install NFS utils.
yum:
name: nfs-utils
when: pfs_mounts | selectattr('type', 'search', 'nfs') | list | length >= 1
become: true
...
12 changes: 0 additions & 12 deletions roles/nfs_home_client/tasks/main.yml

This file was deleted.

4 changes: 0 additions & 4 deletions roles/nfs_home_server/defaults/main.yml

This file was deleted.

31 changes: 0 additions & 31 deletions roles/nfs_home_server/tasks/main.yml

This file was deleted.

40 changes: 0 additions & 40 deletions roles/nfs_home_server/tasks/mount.yml

This file was deleted.

30 changes: 30 additions & 0 deletions roles/nfs_server/handlers/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
#
# Important: maintain correct handler order.
# Handlers are executed in the order in which they are defined
# and not in the order in which they are listed in a "notify: handler_name" statement!
#
# Restart before reload: an reload after a restart may be redundant but should not fail,
# but the other way around may fail when the impact of changes was too large for a reload.
#
- name: 'Restart nfs-server service.'
systemd:
name: 'nfs-server.service'
state: restarted
daemon_reload: true
become: true
listen: restart_nfs-server

- name: 'Reload nfs-server service.'
systemd:
name: 'nfs-server.service'
state: reloaded
daemon_reload: true
become: true
listen: reload_nfs-server

- name: '(Re)export all NFS shares.'
command: 'exportfs -a'
become: true
listen: export_nfs_shares
...
34 changes: 34 additions & 0 deletions roles/nfs_server/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#
# This role may depend on the mount_volume role to mount the filesystems that must be exported over NFS.
#
---
- name: 'Install NFS utils.'
yum:
name: nfs-utils
notify:
- restart_nfs-server
- export_nfs_shares
become: true

- name: 'Enable and start nfs-server service.'
systemd:
name: nfs-server.service
state: 'started'
enabled: true
daemon_reload: true
notify:
- export_nfs_shares
become: true

- name: 'Add NFS share to /etc/exports.'
lineinfile:
path: /etc/exports
line: "/mnt/{{ item.pfs }} {{ network_private_storage_cidr }}(rw,sync,root_squash,no_subtree_check)"
with_items: "{{ pfs_mounts | selectattr('type', 'search', 'nfs') | selectattr('device', 'defined') | list }}"
notify:
- export_nfs_shares
become: true

- name: Flush handlers
meta: flush_handlers
...
4 changes: 3 additions & 1 deletion roles/shared_storage/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@
opts: "{{ item.rw_options }}"
state: 'mounted'
with_items: "{{ pfs_mounts }}"
when: inventory_hostname in groups['sys_admin_interface']
when:
- inventory_hostname in groups['sys_admin_interface']
- inventory_hostname not in groups ['nfs_server'] | default([]) or 'nfs' not in item.type
become: true

- name: 'Create "home" Logical File System (LFS) on Physical File Systems (PFSs) mounted on SAIs.'
Expand Down
2 changes: 2 additions & 0 deletions single_group_playbooks/cluster_part2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@
- sshd
- ldap # client
- regular_users
- lustre_client
- nfs_client
- shared_storage
...
14 changes: 14 additions & 0 deletions single_group_playbooks/nfs_server.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#
# This play depends on:
# * cluster_part1.yml
#
---
- import_playbook: pre_deploy_checks.yml

- name: '###==-> Extra roles for NFS server. <-==###'
hosts:
- nfs_server
roles:
- mount_volume
- nfs_server
...
1 change: 0 additions & 1 deletion single_group_playbooks/sys_admin_interface.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
hosts:
- sys_admin_interface
roles:
- mount_volume
- slurm_management
- prom_server
- grafana
Expand Down
2 changes: 1 addition & 1 deletion single_role_playbooks/mount_volume.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
- name: Mount the ceph volume
hosts:
- nfs_server
- compute_vm
- sys_admin_interface
- deploy_admin_interface
- data_transfer
roles:
Expand Down
3 changes: 3 additions & 0 deletions static_inventories/wingedhelix_hosts.ini
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ wh-repo
[docs]
docs

[nfs_server]
wh-sai

[sys_admin_interface]
wh-sai

Expand Down