This repository has been archived on 2020-05-08. You can view files and clone it, but cannot push or open issues or pull requests.
dokku-ansible-playbook/functions

23 lines
565 B
Plaintext
Raw Normal View History

2020-03-19 00:43:41 +00:00
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
REQUIREMENTS=".ansible/requirements.yml"
function run_playbook() {
local play_path="$1"
2020-03-19 01:05:30 +00:00
if [[ ! -f "$play_path" ]]; then
2020-03-19 00:43:41 +00:00
echo " $play_path not found or executable bit not set. Skipping ..."
exit 0
fi
2020-03-19 01:05:30 +00:00
if [[ -f "$REQUIREMENTS" ]]; then
2020-03-19 00:43:41 +00:00
echo " $REQUIREMENTS file found. Running it ..."
ansible-galaxy install -fvf "$REQUIREMENTS"
fi
echo " $play_path file found. Running it ..."
ansible-playbook -i 127.0.0.1, --connection local -v "$play_path"
}