#!/bin/bash

[[ -z $1 ]] && echo target? && exit 1
target=$1

echo -n generate ansible_vars.json ...
[[ ! -r ansible_vars ]] && echo cannot read ansible_vars && exit 1
../jsonencode ansible_vars > ansible_vars.json && echo done

# no need to mention the cron jobs
export ANSIBLE_DISPLAY_SKIPPED_HOSTS=false

time ansible-playbook tasks-flb-setup.yml -i ../hosts -e "target=$target" -e @ansible_vars.json --check
echo ready?
read -r
time ansible-playbook tasks-flb-setup.yml -i ../hosts -e "target=$target" -e @ansible_vars.json