forked from ISTI-ansible-roles/ansible-roles
d4science-ghn-cluster: library/roles/smartgears/r_connector: fix the r_connector script that manages the users. Added the required commands to the sudoers file.
This commit is contained in:
parent
b557e575f5
commit
188e4d1079
|
@ -3,28 +3,30 @@
|
||||||
USER="$1"
|
USER="$1"
|
||||||
HDIR="{{ r_connector_usershome }}$USER"
|
HDIR="{{ r_connector_usershome }}$USER"
|
||||||
logfile={{ smartgears_user_home }}/tomcat/logs/runuseradd.log
|
logfile={{ smartgears_user_home }}/tomcat/logs/runuseradd.log
|
||||||
exec > $logfile 2>&1
|
exec >> $logfile 2>&1
|
||||||
|
|
||||||
|
|
||||||
if [ -d $HDIR ] ; then
|
if [ -d $HDIR ] ; then
|
||||||
#echo "user dir exist"
|
echo "user $HDIR dir exists"
|
||||||
exit 0
|
exit 0
|
||||||
else
|
else
|
||||||
if id -u $USER >/dev/null 2>&1
|
if id -u $USER >/dev/null 2>&1
|
||||||
then
|
then
|
||||||
#"echo "ldap user first login"
|
echo "ldap user $USER first login"
|
||||||
sudo /bin/su - $USER /bin/ls
|
sudo /bin/mkdir -p $HDIR
|
||||||
|
sudo /bin/chown -R $USER $HDIR
|
||||||
sudo /bin/chmod g+ws $HDIR
|
sudo /bin/chmod g+ws $HDIR
|
||||||
sudo /usr/bin/touch $HDIR/{{ r_connector_userconfig }}
|
sudo /usr/bin/touch $HDIR/{{ r_connector_userconfig }}
|
||||||
sudo /bin/chmod 660 $HDIR/{{ r_connector_userconfig }}
|
sudo /bin/chmod 660 $HDIR/{{ r_connector_userconfig }}
|
||||||
sudo /bin/chgrp -R {{ smartgears_user }} $HDIR
|
sudo /bin/chgrp -R {{ smartgears_user }} $HDIR
|
||||||
exit 0
|
exit 0
|
||||||
else
|
else
|
||||||
#echo "user does not exist and is not ldap"
|
echo "user $USER does not exist and is not into ldap"
|
||||||
sudo /usr/sbin/useradd -m -s /bin/false -g {{ smartgears_user }} $USER
|
sudo /usr/sbin/useradd -m -s /bin/false -g {{ smartgears_user }} $USER
|
||||||
sudo /bin/chmod g+ws $HDIR
|
sudo /bin/chmod g+ws $HDIR
|
||||||
sudo /usr/bin/touch $HDIR/{{ r_connector_userconfig }}
|
sudo /usr/bin/touch $HDIR/{{ r_connector_userconfig }}
|
||||||
sudo /bin/chmod 660 $HDIR/{{ r_connector_userconfig }}
|
sudo /bin/chmod 660 $HDIR/{{ r_connector_userconfig }}
|
||||||
sudo /bin/chgrp -R {{ smartgears_user }} $HDIR
|
sudo /bin/chgrp -R {{ smartgears_user }} $HDIR
|
||||||
|
exit 0
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue