diff --git a/playbook-template/bootstrap.sh b/playbook-template/bootstrap.sh index d13c8c99ea7cd9ffc34c4c77ea02b5f058591b13..77fe52162d67af0f5194a40af6c7be09b605a174 100755 --- a/playbook-template/bootstrap.sh +++ b/playbook-template/bootstrap.sh @@ -1,28 +1,8 @@ #!/usr/bin/env bash -########################### Config #################################### - -reporaw="https://git.sch.bme.hu/kszk/sysadmin/ansible/ansci/-/raw/master/playbook-template" - -########################### Methods #################################### - -download() { - local url="$1" - local dest="$2" - if command -v wget &>/dev/null; then - wget "$url" -O "$dest" - else - curl "$url" -O "$dest" - fi -} - -downloadFile() { - download "$reporaw/$1" "$1" -} - ########################### Virtualenv setup #################################### -downloadFile "requirements.python.txt" +echo ansible > requirements.python.txt # check existance of virtualenv command if ! command -v virtualenv &>/dev/null; then @@ -33,14 +13,16 @@ if ! command -v virtualenv &>/dev/null; then exit 1 fi -# create virtualenv if not present -[[ ! -d .venv ]] && virtualenv .venv +# if not in virtualenv +if [[ "$VIRTUAL_ENV" == "" ]]; then + # create virtualenv if not present + [[ ! -d .venv ]] && virtualenv .venv -source .venv/bin/activate -pip install -r requirements.python.txt + source .venv/bin/activate + pip install -r requirements.python.txt +fi ########################### Ansible setup #################################### - ansible-galaxy install -r requirements.galaxy.yml ########################### Help to ${dummies:Mike} ####################################