summaryrefslogtreecommitdiff
path: root/vm-install.sh
blob: 8d2bc665c7fce6bda4e0ed79f1fcfeeff4326611 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/bash

if [ -z "$1" ] || [ -z "$2" ] || [ -z "$3" ]; then
  echo "$0 <vm> <distro> <codename>"
  exit 1
fi
name=$1
shift
distro=$1
shift
codename=$1
shift

source "${BASH_SOURCE%/*}/common/utils.sh"
get_ansible_variable env_group "$name"
if [ $? -ne 0 ]; then
  exit 1
fi

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"