From cb1cd951ad05471332a9b5d1ecad928050230fde Mon Sep 17 00:00:00 2001 From: Kevin Date: Fri, 21 Feb 2025 23:06:03 +0100 Subject: [PATCH] =?UTF-8?q?Ajout=20de=20la=20gestion=20du=20mot=20de=20pas?= =?UTF-8?q?se=20sudo=20dans=20le=20script=20d'ex=C3=A9cution=20des=20playb?= =?UTF-8?q?ooks=20Ansible?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ansible/run_playbooks.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ansible/run_playbooks.sh b/ansible/run_playbooks.sh index ab2e1ac..5b6c6e5 100755 --- a/ansible/run_playbooks.sh +++ b/ansible/run_playbooks.sh @@ -5,6 +5,9 @@ GREEN='\033[0;32m' RED='\033[0;31m' NC='\033[0m' # No Color +# Définition du mot de passe sudo +SUDO_PASSWORD="12345" + # Liste des playbooks à exécuter PLAYBOOKS=( "playbooks/1_docker.yml" @@ -16,7 +19,7 @@ PLAYBOOKS=( # Fonction pour exécuter un playbook run_playbook() { echo -e "${GREEN}Exécution du playbook: $1${NC}" - if ansible-playbook --ask-become-pass "$1"; then + if ANSIBLE_BECOME_PASS="$SUDO_PASSWORD" ansible-playbook "$1"; then echo -e "${GREEN}✓ Playbook $1 exécuté avec succès${NC}" return 0 else