summaryrefslogtreecommitdiff
path: root/run-host-playbook.sh
blob: d2f120b6486c9a0ed114db502214d2384651f29d (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
#!/bin/bash

if [ -z "$1" ]; then
  echo "$0 <host>"
  exit 1
fi
host="$1"
shift

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

echo "######## running host playbook for host '$host' in environment '$env_group' ########"
declare -a extra_vars
if [ -e "$env_group/$host.yml" ]; then
  install_playbook="$host"
else
  extra_vars+=(-e "install_hostname=$host")
  ansible_variable__get install_playbook "$host" > /dev/null 2>&1 || install_playbook="common"
fi
exec ansible-playbook ${extra_vars[@]} $@ "$env_group/$install_playbook.yml"