#!/bin/bash
if [ -z "$1" ] || [ -z "$2" ] || [ -z "$3" ]; then
- echo "$0 <vm> <distro> <codename>"
+ echo "$0 <hostname> <distro> <codename>"
exit 1
fi
-echo "installing vm: $1 with $2/$3"
-echo ""
+name=$1
+shift
+distro=$1
+shift
+codename=$1
+shift
-echo "########## clearing old ssh host keys #########"
-./remove-known-host.sh "$1"
+echo "installing $name with $distro/$codename"
echo ""
echo "######## running the install playbook ########"
-exec ansible-playbook -e "vmname=$1" -e "vmdistro=$2" -e "vmdistcodename=$3" vm-install.yml
+exec ansible-playbook -e "hostname=$name" -e "install_distro=$distro" -e "install_codename=$codename" $@ $(basename "$0" .sh).yml