Skip to content
Snippets Groups Projects
Commit f71716da authored by Bo-Chun Chen's avatar Bo-Chun Chen
Browse files

Merge branch 'feat-autofs' into 'main'

Feat autofs

Closes #113

See merge request rc/packer-openstack-hpc-image!80
parents 0baa78b5 d756bcdc
No related branches found
No related tags found
No related merge requests found
...@@ -275,7 +275,6 @@ test_ood_image: ...@@ -275,7 +275,6 @@ test_ood_image:
chown shibd:shibd /run/shibboleth chown shibd:shibd /run/shibboleth
pip3 install s3cmd 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/ 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 OEOF
- > - >
export NEW_INSTANCE_ID=$(openstack server create export NEW_INSTANCE_ID=$(openstack server create
...@@ -295,11 +294,11 @@ test_ood_image: ...@@ -295,11 +294,11 @@ test_ood_image:
|| FAILED=true || FAILED=true
- | - |
if [ $CI_PIPELINE_SOURCE == 'merge_request_event' ]; then 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 elif [ $CI_PIPELINE_SOURCE == 'schedule' ]; then
cp "$SSH_KNOWN_HOSTS" ~/.ssh/known_hosts cp "$SSH_KNOWN_HOSTS" ~/.ssh/known_hosts
chmod 644 ~/.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 fi
- | - |
if [ "$FAILED" = true ]; then if [ "$FAILED" = true ]; then
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
yum_repo_files: yum_repo_files:
- cm.repo - cm.repo
pkg_list: pkg_list:
- autofs
- Lmod - Lmod
- tmux - tmux
- vim - vim
...@@ -11,20 +11,44 @@ ...@@ -11,20 +11,44 @@
- { dir: /data/rc/apps, mode: '0755' } # this is only required for the symlink to be happy - { dir: /data/rc/apps, mode: '0755' } # this is only required for the symlink to be happy
- { dir: /data/user, mode: '0755' } - { dir: /data/user, mode: '0755' }
- { dir: /data/project, mode: '0755' } - { dir: /data/project, mode: '0755' }
- name: Set up NFS GPFS mount point(s)
ansible.posix.mount: - name: Remove unused entry in master map
path: "{{ item.path }}" ansible.builtin.replace:
src: "{{ item.src }}" dest: /etc/auto.master
fstype: "{{ item.fstype }}" regexp: '{{ item.regexp }}'
opts: "{{ item.opts }}" replace: '{{ item.replace }}'
state: present 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: loop:
- { path: /cm/shared, src: "gpfs.rc.uab.edu:/data/cm/shared-8.2", fstype: nfs, opts: "vers=3,_netdev,defaults" } - { map_name: "cm-share", key: "*", src: "gpfs.rc.uab.edu:/data/cm/shared-8.2/&", opts: "fstype=nfs,vers=3,_netdev,defaults" }
- { path: /data/project, src: "gpfs.rc.uab.edu:/data/project", fstype: nfs, opts: "vers=3,_netdev,defaults" } - { map_name: "data-project", key: "*", src: "gpfs.rc.uab.edu:/data/project/&", opts: "fstype=nfs,vers=3,_netdev,defaults" }
- { path: /data/user, src: "gpfs.rc.uab.edu:/data/user", fstype: nfs, opts: "vers=3,_netdev,local_lock=posix,defaults" } - { map_name: "data-user", key: "*", src: "gpfs.rc.uab.edu:/data/user/&", opts: "fstype=nfs,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" } - { map_name: "data-rc-apps", key: "*", src: "gpfs.rc.uab.edu:/data/rc/apps/&", opts: "fstype=nfs,vers=3,_netdev,defaults" }
- { path: /scratch, src: "gpfs.rc.uab.edu:/scratch", fstype: nfs, opts: "vers=3,_netdev,local_lock=posix,defaults" } - { map_name: "scratch", key: "/scratch", src: "gpfs.rc.uab.edu:/scratch", opts: "fstype=nfs,vers=3,_netdev,local_lock=posix,defaults" }
- { path: /home, src: "/data/user/home", fstype: none, opts: bind } - { map_name: "home", key: "*", src: ":/data/user/home/&", opts: 'fstype=bind' }
- name: Create symbolic links - name: Create symbolic links
ansible.builtin.file: ansible.builtin.file:
src: "{{ item.src }}" src: "{{ item.src }}"
...@@ -35,3 +59,8 @@ ...@@ -35,3 +59,8 @@
state: link state: link
loop: loop:
- { src: /data/rc/apps, dest: /share/apps } - { src: /data/rc/apps, dest: /share/apps }
- name: Enable autofs service
ansible.builtin.service:
name: autofs
enabled: true
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment