From 96e0db225ed30068f6a52c46b880ecad2db653d0 Mon Sep 17 00:00:00 2001 From: Eesaan Atluri <atlurie@uab.edu> Date: Mon, 16 Dec 2024 12:33:28 -0600 Subject: [PATCH] feat: Add params to define the autofs mountpoints Closes https://gitlab.rc.uab.edu/rc/hpc-factory/-/issues/173 --- ansible/group_vars/all | 8 +++++++ ansible/roles/nfs_mounts/tasks/autofs.yml | 26 +++++++++-------------- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/ansible/group_vars/all b/ansible/group_vars/all index d1b1c9a..9b6b230 100644 --- a/ansible/group_vars/all +++ b/ansible/group_vars/all @@ -34,6 +34,14 @@ mount_points: - { "src": "master:/gpfs4", "path": "/gpfs4", "opts": "ro,sync,hard", "mode": "0755" } - { "src": "master:/gpfs5", "path": "/gpfs5", "opts": "ro,sync,hard", "mode": "0755" } + autofs_mounts: + - { mount_point: "/cm/shared", map_name: "cm-share", dir: "/cm/shared", mode: '0755', key: "*", src: "gpfs.rc.uab.edu:/data/cm/shared-8.2/&", opts: "fstype=nfs,vers=3,_netdev,defaults" } + - { mount_point: "/data/project", map_name: "data-project", dir: "/data/project", mode: '0755', key: "*", src: "gpfs.rc.uab.edu:/data/project/&", opts: "fstype=nfs,vers=3,_netdev,defaults" } + - { mount_point: "/data/user", map_name: "data-user", dir: "/data/user", mode: '0755', key: "*", src: "gpfs.rc.uab.edu:/data/user/&", opts: "fstype=nfs,vers=3,_netdev,local_lock=posix,defaults" } + - { mount_point: "/data/rc/apps", map_name: "data-rc-apps", dir: "/data/rc/apps", mode: '0755', key: "*", src: "gpfs.rc.uab.edu:/data/rc/apps/&", opts: "fstype=nfs,vers=3,_netdev,defaults" } + - { mount_point: "/-", map_name: "scratch", dir: "/scratch", mode: '0755', key: "/scratch", src: "gpfs.rc.uab.edu:/scratch", opts: "fstype=nfs,vers=3,_netdev,local_lock=posix,defaults" } + - { mount_point: "/home", map_name: "home", dir: "/data/user/home", mode: '0755', key: "*", src: ":/data/user/home/&", opts: 'fstype=bind' } + #SSH Host Keys S3_ENDPOINT: "" diff --git a/ansible/roles/nfs_mounts/tasks/autofs.yml b/ansible/roles/nfs_mounts/tasks/autofs.yml index 39ba56e..daf9f01 100644 --- a/ansible/roles/nfs_mounts/tasks/autofs.yml +++ b/ansible/roles/nfs_mounts/tasks/autofs.yml @@ -6,11 +6,15 @@ mode: "{{ item.mode }}" loop: - { dir: /local, mode: '0777' } - - { dir: /scratch, mode: '0755' } - { dir: /share, mode: '0755' } - - { 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: Create mountpoint dirs + ansible.builtin.file: + path: "{{ item.dir }}" + state: directory + mode: "{{ item.mode }}" + loop: + "{{ autofs_mounts }}" - name: Remove unused entry in master map ansible.builtin.replace: @@ -29,12 +33,7 @@ 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: "/-", map_name: "scratch" } - - { mount_point: "/home", map_name: "home" } + "{{ autofs_mounts }}" - name: Set up autofs map files ansible.builtin.lineinfile: @@ -42,12 +41,7 @@ line: "{{ item.key }} -{{ item.opts }} {{ item.src }}" create: true loop: - - { 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: "/scratch", 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' } + "{{ autofs_mounts }}" - name: Create symbolic links ansible.builtin.file: -- GitLab