Ajout script reinitialisation

This commit is contained in:
Axel 2024-05-23 08:05:32 +02:00
parent 9aca96187b
commit 44c89e4e04
3 changed files with 48 additions and 1 deletions

View File

@ -13,4 +13,5 @@
- include_tasks: tasks/users.yml
- include_tasks: tasks/cron.yml
- include_tasks: tasks/packages.yml
- include_tasks: tasks/loritz-user.yml
- include_tasks: tasks/loritz-user.yml
- include_tasks: tasks/bin.yml

7
tasks/bin.yml Normal file
View File

@ -0,0 +1,7 @@
- name: Copie scriptes vers bin
copy:
src: files/bin/
dest: /usr/bin/
owner: root
group: root
mode: 0755

View File

@ -0,0 +1,39 @@
#!/bin/bash
# Test si root
if [ "$EUID" -ne 0 ]
then echo "Merci d'éxécuter en tant que root"
exit
fi
# Demande confirmation
while true; do
read -p "Etes vous sûr de vouloir réinitialiser l'utilisateur loritz ? (y/n) " yn
case $yn in
[yY] ) echo "OK, nous allons commencer !";
break;;
[nN] ) echo "Ah... Dommage";
exit;;
* ) echo Réponse invalide;;
esac
done
# Début du travail
echo ""
echo "***** Réinitialisation de l'utilisateur loritz *****"
echo ""
userdel -r -f loritz
ansible-pull -U https://git.axolito.fr/Axel/laptop_playbook.git
echo ""
echo "***** Réinitialisation terminée *****"
echo ""
echo "***** Le PC va redémarrer dans 5 secondes *****"
echo ""
sleep 5s
reboot