diff --git a/deploy.sh b/deploy.sh index 270a728..2d2bafe 100755 --- a/deploy.sh +++ b/deploy.sh @@ -2,17 +2,23 @@ CMD="ANSIBLE_RETRY_FILES_ENABLED=0 ansible-playbook recette.yml" -if [[ $# = 0 ]]; then - CMD="$CMD --connection=local --inventory 127.0.0.1, --limit 127.0.0.1" -fi +REMOTE=false for arg in "$@"; do if [[ $arg = "remote" ]]; then + REMOTE=true CMD="$CMD -i hosts" fi if [[ $arg = "check" ]]; then CMD="$CMD --syntax-check" fi + if [[ $arg = "debug" ]]; then + CMD="$CMD -vvv" + fi done +if [[ $REMOTE = false ]]; then + CMD="$CMD --connection=local --inventory 127.0.0.1, --limit 127.0.0.1" +fi + eval $CMD diff --git a/docs/administrateurice.md b/docs/administrateurice.md index 07bcdbd..d4fe40d 100644 --- a/docs/administrateurice.md +++ b/docs/administrateurice.md @@ -98,10 +98,11 @@ user@client:~/infra $ ./deploy.sh remote root@server:~/infra $ ./deploy.sh ``` -Additionnellement, deploy.sh accepte un argument `check` qui déclenche une simple vérification de la syntaxe Ansible. En résumé : +Additionnellement, deploy.sh accepte un argument `check` qui déclenche une simple vérification de la syntaxe Ansible. Enfin, la commande accepte également un argument `debug` qui envoie "-vvv" à Ansible. En résumé : ``` -deploy.sh [remote|check] [remote|check] +deploy.sh [remote|check|debug] .. check: vérifie la syntaxe ansible remote: applique la recette sur un serveur distant (défini dans ./hosts) + debug: active le debug de ansible ```