diff --git a/ansible/roles/nfs_mounts/tasks/main.yml b/ansible/roles/nfs_mounts/tasks/main.yml index 0203f2ea812d4a3e183608963926c583bfac22a7..c5c6f1f6c74f221e9432b129f217eb17bfa56652 100644 --- a/ansible/roles/nfs_mounts/tasks/main.yml +++ b/ansible/roles/nfs_mounts/tasks/main.yml @@ -11,20 +11,32 @@ - { dir: /data/rc/apps, mode: '0755' } # this is only required for the symlink to be happy - { dir: /data/user, mode: '0755' } - { dir: /data/project, mode: '0755' } -- name: Set up NFS GPFS mount point(s) - ansible.posix.mount: - path: "{{ item.path }}" - src: "{{ item.src }}" - fstype: "{{ item.fstype }}" - opts: "{{ item.opts }}" - state: present + +- name: Add master map file + ansible.builtin.lineinfile: + path: "/etc/auto.master.d/gpfs.autofs" + line: "{{ item.mount_point }} /etc/auto.{{ item.map_name }}" + create: yes + loop: + - { mount_point: "/cm/shared", map_name: "cm-share" } + - { mount_point: "/data/project", map_name: "data-project" } + - { mount_point: "/data/user", map_name: "data-user" } + - { mount_point: "/data/rc/apps", map_name: "data-rc-apps" } + - { mount_point: "/scratch", map_name: "scratch" } + - { mount_point: "/home", map_name: "home" } + +- name: Set up autofs map files + ansible.posix.lineinfile: + path: "/etc/auto.{{ item.map_name }}" + line: "{{ item.key }} -{{ item.opts }} {{ item.src }}" loop: - - { path: /cm/shared, src: "gpfs.rc.uab.edu:/data/cm/shared-8.2", fstype: nfs, opts: "vers=3,_netdev,defaults" } - - { path: /data/project, src: "gpfs.rc.uab.edu:/data/project", fstype: nfs, opts: "vers=3,_netdev,defaults" } - - { path: /data/user, src: "gpfs.rc.uab.edu:/data/user", fstype: nfs, opts: "vers=3,_netdev,local_lock=posix,defaults" } - - { path: /data/rc/apps, src: "gpfs.rc.uab.edu:/data/rc/apps", fstype: nfs, opts: "vers=3,_netdev,defaults" } - - { path: /scratch, src: "gpfs.rc.uab.edu:/scratch", fstype: nfs, opts: "vers=3,_netdev,local_lock=posix,defaults" } - - { path: /home, src: "/data/user/home", fstype: none, opts: bind } + - { map_name: "cm-share", key: "*", src: "gpfs.rc.uab.edu:/data/cm/shared-8.2/&", opts: "fstype=nfs,vers=3,_netdev,defaults" } + - { map_name: "data-project", key: "*", src: "gpfs.rc.uab.edu:/data/project/&", opts: "fstype=nfs,vers=3,_netdev,defaults" } + - { map_name: "data-user", key: "*", src: "gpfs.rc.uab.edu:/data/user/&", opts: "fstype=nfs,vers=3,_netdev,local_lock=posix,defaults" } + - { map_name: "data-rc-apps", key: "*", src: "gpfs.rc.uab.edu:/data/rc/apps/&", opts: "fstype=nfs,vers=3,_netdev,defaults" } + - { map_name: "scratch", key: "*", src: "gpfs.rc.uab.edu:/scratch/&", opts: "fstype=nfs,vers=3,_netdev,local_lock=posix,defaults" } + - { map_name: "home", key: "*", src: ":/data/user/home/&", opts: 'fstype=bind' } + - name: Create symbolic links ansible.builtin.file: src: "{{ item.src }}"