siotp/sisr1/tp04-scripts-admin/deployUsers.sh
2025-03-24 09:20:36 +01:00

22 lines
406 B
Bash

#!/bin/bash
ip=$1
workdir=/root/deploy
ssh root@$ip "mkdir $workdir" 2> /dev/null
scp createGroups.sh $user$ip:$workdir
scp createUser.sh $user$ip:$workdir
scp login.csv $user$ip:/root
scp Users.csv $user$ip:/root
# exécution des scripts
ssh $user@$ip "bash $workdir/createGroups.sh"
ssh $user@$ip "bash $workdir/createUsers.sh"
ssh root@$ip "rm -R $workdir" # suppression répertoire et scripts