Compare commits
No commits in common. "598233bc336c1fb6fbaca560560cc60d1b727f0d" and "d4f8af8e5492d27f08c4521e8c4e0164061b2654" have entirely different histories.
598233bc33
...
d4f8af8e54
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,2 +0,0 @@
|
|||||||
# Ignorer le fichier d'environnement
|
|
||||||
.env
|
|
||||||
@ -1,54 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
|
|
||||||
# Charger le .env
|
|
||||||
if [ -f .env ]; then
|
|
||||||
export $(grep -v '^#' .env | xargs)
|
|
||||||
fi
|
|
||||||
|
|
||||||
#Si rien n'est passé dans le prompt valeur n par défaut
|
|
||||||
read -e -p "Attention vous allez réinitialiser complétement la salle, voullez vous vraiment continuer [o/n] : " -i "n" confirmation
|
|
||||||
|
|
||||||
echo "Vous avez entré ${confirmation}"
|
|
||||||
|
|
||||||
|
|
||||||
if [ $confirmation == 'o' ];
|
|
||||||
then
|
|
||||||
|
|
||||||
echo "Lancement de la tâche de réinitialisation de la salle"
|
|
||||||
|
|
||||||
#Script
|
|
||||||
#curl -H "fog-api-token: ${FOG_API_TOKEN}" -H "fog-user-token: ${FOG_USER_TOKEN}" -H "Content-Type: application/json" -X GET http://localhost/fog/group | jq
|
|
||||||
|
|
||||||
|
|
||||||
#Variables de configuration de la tâche
|
|
||||||
GROUP_ID="1"
|
|
||||||
IMAGE_ID="1"
|
|
||||||
TASK_TYPE="1" #Déploiement multicast
|
|
||||||
SHUTDOWN="1" #Eteindre les machines à la fin
|
|
||||||
|
|
||||||
|
|
||||||
#Wake On LAN du groupe
|
|
||||||
echo "Envoi du Wake On LAN vers le groupe ${GROUP_ID}"
|
|
||||||
curl -H "fog-api-token: ${FOG_API_TOKEN}" -H "fog-user-token: ${FOG_USER_TOKEN}" -X POST http://localhost/fog/group/${GROUP_ID}/wol
|
|
||||||
|
|
||||||
|
|
||||||
#Construction du JSON avec les paramètres de la tâche
|
|
||||||
DATA=$(cat <<EOF
|
|
||||||
{
|
|
||||||
"taskTypeID": "$TASK_TYPE",
|
|
||||||
"shutdown": "$SHUTDOWN",
|
|
||||||
"imageID": "$IMAGE_ID"
|
|
||||||
}
|
|
||||||
EOF
|
|
||||||
)
|
|
||||||
|
|
||||||
#Création de la tâche
|
|
||||||
curl -H "fog-api-token: ${FOG_API_TOKEN}" -H "fog-user-token: ${FOG_USER_TOKEN}" -H "Content-Type: application/json" -X POST http://localhost/fog/group/${GROUP_ID}/task -d "$DATA"
|
|
||||||
|
|
||||||
|
|
||||||
else
|
|
||||||
echo "Annulation de la tâche de réinitialisation de la salle"
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "FIN"
|
|
||||||
Loading…
x
Reference in New Issue
Block a user