diff --git a/README.md b/README.md index bd26820..9880cee 100644 --- a/README.md +++ b/README.md @@ -61,7 +61,7 @@ kickstart compile Takes an host target and deploy the compiled code on it. ```bash -kickstart deploy [--sudo] [target] [roles ...] +kickstart deploy [--sudo] [--password PASSWORD] target [roles ...] ``` ##### Examples @@ -77,6 +77,12 @@ Deploy two roles on a host with an alternative port kickstart deploy "-p 2222 vagrant@localhost" nodejs redis ``` +Deploy with sudo and send the password for sudo + +```bash +kickstart deploy --sudo --password vagrant "-p 2222 vagrant@localhost" nodejs redis +``` + #### local Deploy localy a recipe that is not over ssh. It basicaly compile and run the install script diff --git a/lib/kickstart-deploy b/lib/kickstart-deploy index 004c65f..e0824d3 100755 --- a/lib/kickstart-deploy +++ b/lib/kickstart-deploy @@ -1,12 +1,12 @@ #!/bin/bash -e [[ "$1" == "--sudo" ]] && prefix="sudo " && shift +[[ "$1" == "--password" ]] && shift && prefix="echo \"$1\" | sudo -S " && shift target=$1 [ "$target" ] || echo "Please, provide an ssh target" shift -[[ "$1" == "--sudo" ]] && prefix="sudo " && shift [ "$DEBUG" ] && debug="-x" remote_command=$(