Verified Commit 66dbcd4b authored by Todor Kondic's avatar Todor Kondic
Browse files

shared-mounts: Mount shared drives

parent cb179d2b
#!/bin/sh
path_to_cred="$1"
sudo_user=$(whoami)
sudo_home="$HOME"
eci_group=$(getent group eci|cut -d: -f3)
# [ -e "/mnt/LCSB_ECI" ] && echo "Path /mnt/LCSB_ECI exists." || echo "Creating /mnt/LCSB_ECI" && sudo mkdir -p /mnt/LCSB_ECI
# [ -e "/mnt/LCSB_ECI_01" ] && echo "Path /mnt/LCSB_ECI_01 exists." || echo "Creating /mnt/LCSB_ECI_01" && sudo mkdir -p /mnt/LCSB_ECI_01
# ! mount|grep "/mnt/LCSB_ECI" && echo "Fixing permission for /mnt/LCSB_ECI" && sudo chown "$sudo_user" /mnt/LCSB_ECI
# ! mount|grep "/mnt/LCSB_ECI_01" && echo "Fixing permission for /mnt/LCSB_ECI_01" && sudo chown "$sudo_user" /mnt/LCSB_ECI_01
! mount|grep "LCSB_ECI " >/dev/null && sudo mount -t cifs //atlas.uni.lux/LCSB_ECI /mnt/LCSB_ECI -o iocharset=utf8,gid="$eci_group",dir_mode=0775,noperm,credentials="$path_to_cred" || echo LCSB_ECI already mounted. Skipping. >& 2
! mount|grep LCSB_ECI_01 >/dev/null && sudo mount -t cifs //isilon-dmzi.uni.lux/LCSB_ECI_01 /mnt/LCSB_ECI_01 -o iocharset=utf8,gid="$eci_group",dir_mode=0775,noperm,credentials="$path_to_cred" || echo LCSB_ECI_01 already mounted. Skipping. >& 2
exit 0
- hosts: stations
become: True
become_user: adamsmith
become_method: sudo
tasks:
- name: Copy mount script.
become_user: root
copy:
src: files/usr/local/bin/unilu-drives
dest: /usr/local/bin/unilu-drives
mode: 0770
owner: adamsmith
group: wheel
- name: Copy .smb_credentials .
become_user: root
copy:
src: meta/.smb_credentials
dest: /home/adamsmith/.smb_credentials
mode: 0600
owner: adamsmith
group: wheel
- name: Run mount script.
command: /usr/local/bin/unilu-drives /home/adamsmith/.smb_credentials
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment