diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 76626d19787f337bab4f833de80e15f490d7cb0d..938283ddcb18b6fd814ec3d9be341359bdc0dfc1 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -275,7 +275,6 @@ test_ood_image: chown shibd:shibd /run/shibboleth pip3 install s3cmd s3cmd get --force -r --access_key=$AWS_ACCESS_KEY_ID --secret_key=$AWS_SECRET_ACCESS_KEY --host=$AWS_HOST --host-bucket=$AWS_HOST s3://knightly-key/ /etc/ssh/ - mount | grep home || mount /home OEOF - > export NEW_INSTANCE_ID=$(openstack server create @@ -295,11 +294,11 @@ test_ood_image: || FAILED=true - | if [ $CI_PIPELINE_SOURCE == 'merge_request_event' ]; then - ssh -o StrictHostKeyChecking=no acctsvc@$FLOATING_IP '[ $(mount | grep "type nfs" | wc -l) -eq 6 ]' || FAILED=true + ssh -o StrictHostKeyChecking=no acctsvc@$FLOATING_IP '[ $(mount | grep "etc/auto" | wc -l) -eq 6 ]' || FAILED=true elif [ $CI_PIPELINE_SOURCE == 'schedule' ]; then cp "$SSH_KNOWN_HOSTS" ~/.ssh/known_hosts chmod 644 ~/.ssh/known_hosts - ssh acctsvc@$FLOATING_IP '[ $(mount | grep "type nfs" | wc -l) -eq 6 ]' || FAILED=true + ssh acctsvc@$FLOATING_IP '[ $(mount | grep "etc/auto" | wc -l) -eq 6 ]' || FAILED=true fi - | if [ "$FAILED" = true ]; then diff --git a/ansible/group_vars/ood b/ansible/group_vars/ood index 1c916b24173b03e33f0c2a1a8f2a60302a52b10a..c55b91529b1f50e66f6c7c71d742a7b0483890c9 100644 --- a/ansible/group_vars/ood +++ b/ansible/group_vars/ood @@ -2,6 +2,7 @@ yum_repo_files: - cm.repo pkg_list: + - autofs - Lmod - tmux - vim diff --git a/ansible/roles/nfs_mounts/tasks/main.yml b/ansible/roles/nfs_mounts/tasks/main.yml index 0203f2ea812d4a3e183608963926c583bfac22a7..39ba56e6d4f2ab399f6c80ff157cf6a51b4e40ff 100644 --- a/ansible/roles/nfs_mounts/tasks/main.yml +++ b/ansible/roles/nfs_mounts/tasks/main.yml @@ -11,20 +11,44 @@ - { 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: Remove unused entry in master map + ansible.builtin.replace: + dest: /etc/auto.master + regexp: '{{ item.regexp }}' + replace: '{{ item.replace }}' + backup: true + loop: + - { regexp: '^(/misc)', replace: '#\1' } + - { regexp: '^(/net)', replace: '#\1' } + - { regexp: '^(\+auto.master)', replace: '#\1' } + +- 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: "/-", map_name: "scratch" } + - { mount_point: "/home", map_name: "home" } + +- name: Set up autofs map files + ansible.builtin.lineinfile: + path: "/etc/auto.{{ item.map_name }}" + line: "{{ item.key }} -{{ item.opts }} {{ item.src }}" + create: true 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: "/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' } + - name: Create symbolic links ansible.builtin.file: src: "{{ item.src }}" @@ -35,3 +59,8 @@ state: link loop: - { src: /data/rc/apps, dest: /share/apps } + +- name: Enable autofs service + ansible.builtin.service: + name: autofs + enabled: true