ansible/files/scripts/bashrc/deploy-bashrc.sh

29 lines
662 B
Bash
Raw Permalink Normal View History

#!/bin/bash
# This script deploys a custom bashrc to the Userhomes on nodes
# Vars
BASHRC_URL=https://config.voser.cloud/linux/bash/bashrc
BASHRC_TMP_PATH=/tmp/bashrc
# Information Gatering
## Get the bashrc
curl -k $BASHRC_URL > $BASHRC_TMP_PATH
#Script
## Get the Userhomes & Write BASHRC to USERhome
for USER in $(ls /home/*/ -d | cut -d "/" -f 3)
do
cp $BASHRC_TMP_PATH /home/$USER/.bashrc
chown $USER /home/$USER/.bashrc
chgrp $USER /home/$USER/.bashrc
done
## Write the Custom bash to the Root Usershome directory
cp $BASHRC_TMP_PATH /root/.bashrc
chown root /root/.bashrc
chgrp root /root/.bashrc
# Remove temporary Bashrc
rm -f $BASHRC_TMP_PATH