diff --git a/playbooks/test.yml b/playbooks/test.yml index b9b98ea..9cd0141 100644 --- a/playbooks/test.yml +++ b/playbooks/test.yml @@ -5,3 +5,4 @@ - core - csc-auth - csc-packages + - csc-filesystems diff --git a/roles/csc-filesystems/handlers/main.yml b/roles/csc-filesystems/handlers/main.yml new file mode 100644 index 0000000..330e708 --- /dev/null +++ b/roles/csc-filesystems/handlers/main.yml @@ -0,0 +1,7 @@ +--- + +- name: Restart GSSD + service: + name: rpc-gssd + state: restarted + enabled: true diff --git a/roles/csc-filesystems/tasks/main.yml b/roles/csc-filesystems/tasks/main.yml new file mode 100644 index 0000000..e0adb90 --- /dev/null +++ b/roles/csc-filesystems/tasks/main.yml @@ -0,0 +1,101 @@ +--- + +- name: Install nfs utilities + apt: + name: nfs-common + cache_valid_time: 3600 + +- name: Enable GSSD + lineinfile: + dest: /etc/default/nfs-common + state: present + backrefs: true + regexp: ^NEED_GSSD=$ + line: NEED_GSSD=1 + notify: + - Restart GSSD + +- name: Ensure mountpoints exist + file: + path: '{{ item }}' + state: directory + with_items: + - /users + - /u + - /scratch + +- name: Ensure music mountpoint exist + when: mount_music is defined + file: + path: /music + state: directory + +- name: Mount home directories (sec=sys) + when: mount_home_sys is defined and not(ansible_virtualization_role == 'guest' and ansible_virtualization_type == 'lxc') + mount: + src: '{{ item.src }}' + name: '{{ item.name }}' + fstype: nfs + opts: bg,vers=3,sec=sys,nosuid,nodev + dump: 0 + passno: 0 + state: mounted + with_items: + - src: aspartame.csclub.uwaterloo.ca:/users + name: /users + - src: fs00.csclub.uwaterloo.ca:/users + name: /u + ignore_errors: true + +- name: Mount home directories (sec=krb5p) + when: mount_home_sys is not defined and not(ansible_virtualization_role == 'guest' and ansible_virtualization_type == 'lxc') + mount: + src: '{{ item.src }}' + name: '{{ item.name }}' + fstype: nfs + opts: bg,vers=3,sec=krb5p,nosuid,nodev + dump: 0 + passno: 0 + state: mounted + with_items: + - src: aspartame.csclub.uwaterloo.ca:/users + name: /users + - src: fs00.csclub.uwaterloo.ca:/users + name: /u + ignore_errors: true + +- name: Mount scratch + when: not(ansible_virtualization_role == 'guest' and ansible_virtualization_type == 'lxc') + mount: + src: corn-syrup.csclub.uwaterloo.ca:/scratch + name: /scratch + fstype: nfs + opts: bg,vers=3,sec=sys,nosuid,nodev + dump: 0 + passno: 0 + state: mounted + ignore_errors: true + +- name: Mount music (sec=sys) + when: mount_music is defined and mount_music_sys is defined and not(ansible_virtualization_role == 'guest' and ansible_virtualization_type == 'lxc') + mount: + src: corn-syrup.csclub.uwaterloo.ca:/scratch + name: /scratch + fstype: nfs + opts: bg,vers=3,sec=sys,nosuid,nodev + dump: 0 + passno: 0 + state: mounted + ignore_errors: true + +- name: Mount music (sec=krb5p) + when: mount_music is define and mount_music_sys is not defined and not(ansible_virtualization_role == 'guest' and ansible_virtualization_type == 'lxc') + mount: + src: corn-syrup.csclub.uwaterloo.ca:/scratch + name: /scratch + fstype: nfs + opts: bg,vers=3,sec=sys,nosuid,nodev + dump: 0 + passno: 0 + state: mounted + ignore_errors: true