From cf322be68c53dc1f1c641c8bf0ec87b95696b4f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A1n=20Robotka?= <robotka.adrian@gmail.com> Date: Sat, 22 May 2021 16:53:35 +0200 Subject: [PATCH] update bootstrapper --- playbook-template/bootstrap.sh | 43 ++++++++++++++++------------------ 1 file changed, 20 insertions(+), 23 deletions(-) diff --git a/playbook-template/bootstrap.sh b/playbook-template/bootstrap.sh index 4dcf457..165c737 100755 --- a/playbook-template/bootstrap.sh +++ b/playbook-template/bootstrap.sh @@ -2,35 +2,32 @@ ########################### Virtualenv setup #################################### -echo ansible > requirements.python.txt - -# check existance of virtualenv command -if ! command -v virtualenv &>/dev/null; then - echo "This command needs virtualenv to run." - echo "Install it like this:" - printf "\tapt install python3-venv\n" - printf "\tOR pip3 install --user virtualenv\n" - printf "\texport PATH=\"~/.local/bin:\$PATH\"\n" - exit 1 -fi - -# if not in virtualenv -if [[ "$VIRTUAL_ENV" == "" ]]; then - # create virtualenv if not present - [[ ! -d .venv ]] && python3 -m venv .venv - - source .venv/bin/activate - pip install -r requirements.python.txt -fi +# create virtualenv if not present +[[ ! -d .venv ]] && python3 -m venv .venv + +source .venv/bin/activate + +pip3 install ansible ########################### Ansible setup #################################### + ansible-galaxy install -r requirements.galaxy.yml -########################### Help to ${dummies:Mike} #################################### +########################### Help #################################### + +echo +echo "########################################" +echo +echo "Your playbooks:" + +find . -maxdepth 1 -type f -name "*.yaml" | grep -v inventory + +echo +echo "Recommendation: Set up your OpenSSH config based on inventory.yml" echo -echo "Run playbook with:" -printf "\tansible-playbook -i inventory.yaml what_is.yml" +echo "You can run playbook with:" +printf "\tansible-playbook -i inventory.yaml your-playbook.yaml" echo # to stay in our comfy virtualenv -- GitLab