summaryrefslogtreecommitdiff
path: root/generate.sh
blob: b08482f39f0971685eee62c2c02a544ffba2ac9c (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
#!/bin/bash

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

cd "${BASH_SOURCE%/*}"
source common/utils.sh
ansible_variable__get env_group "$names" || exit 1
vault_environment__set "$env_group" || exit 1

echo "generating installer for $distro/$codename in environment '$env_group'"
echo ""

echo "######## running the installer generator ########"
declare -a extra_vars
extra_vars+=(-e "install_hostnames=$names")
extra_vars+=(-e "install_distro=$distro")
extra_vars+=(-e "install_codename=$codename")
extra_vars+=(-e "install_environment=$env_group")
exec ansible-playbook ${extra_vars[@]} $@ "$env_group/$(basename "$0" .sh).yml"