From a9c5560dcca18a0df93341289087a9585fbca29c Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Sat, 1 Jan 2022 17:13:26 +0100 Subject: add new openwrt-based testvm add new vm-deploy playbook and script --- deploy.sh | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100755 deploy.sh (limited to 'deploy.sh') diff --git a/deploy.sh b/deploy.sh new file mode 100755 index 00000000..c073283f --- /dev/null +++ b/deploy.sh @@ -0,0 +1,35 @@ +#!/bin/bash + +if [ -z "$1" ] || [ -z "$2" ] || [ -z "$3" ]; then + echo "$0 " + exit 1 +fi +name=$1 +distro=$2 +codename=$3 +shift 3 + +cd "${BASH_SOURCE%/*}" +source common/utils.sh +ansible_variable__get env_group "$name" || exit 1 +vault_environment__set "$env_group" || exit 1 + +echo "deploying $name with $distro/$codename in environment '$env_group'" +echo "" + +echo "########## clearing old ssh host keys #########" +remove_known_hosts "$name" +echo "" + +echo "########## removing cached facts #########" +rm -f ".cache/facts/$name" +echo "" + +echo "######## running the deploy playbook for $name ########" +declare -a extra_vars +extra_vars+=(-e "install_hostname=$name") +extra_vars+=(-e "install_distro=$distro") +extra_vars+=(-e "install_codename=$codename") +extra_vars+=(-e "install_environment=$env_group") +ansible_variable__get install_playbook "$name" > /dev/null 2>&1 && extra_vars+=(-e "install_playbook=$install_playbook") +exec ansible-playbook ${extra_vars[@]} $@ "$env_group/$(basename "$0" .sh).yml" -- cgit v1.2.3