#!/bin/bash if [ -z "$1" ] || [ -z "$2" ] || [ -z "$3" ]; then echo "$0 " exit 1 fi name=$1 shift distro=$1 shift codename=$1 shift cd "${BASH_SOURCE%/*}" source common/utils.sh ansible_variable__get env_group "$name" || exit 1 vault_environment__set "$env_group" || exit 1 echo "installing vm: $name with $distro/$codename in environment '$env_group'" echo "" echo "########## clearing old ssh host keys #########" ./remove-known-host.sh "$name" echo "" echo "######## running the install playbook ########" exec ansible-playbook -e "vmname=$name" -e "vmdistro=$distro" -e "vmdistcodename=$codename" $@ "$env_group/vm-install.yml"