forked from miguno/wirbelsturm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathansible-playbook
executable file
·31 lines (25 loc) · 1.09 KB
/
ansible-playbook
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
29
30
31
#!/usr/bin/env bash
#
# File: ansible-playbook
# Description: A simple wrapper around `ansible-playbook` that pre-configures several
# Ansible settings so that it works out of the box with
# Wirbelsturm/Vagrant.
MYSELF=`basename $0`
MY_DIR=`echo $(cd $(dirname $0); pwd)`
. $MY_DIR/sh/common.sh
ANSIBLE_PLAYBOOK_BIN="ansible-playbook"
# Disable SSH host key verification. Disabling the verification is usually
# required because of the way Vagrant creates guest VMs (the host keys of
# the VMs may change in between restarts).
export ANSIBLE_HOST_KEY_CHECKING=False
# This script queries Vagrant and parses wirbelsturm.yaml to compile a
# dynamic inventory list of (running) hosts for Ansible.
EXTERNAL_INVENTORY_SCRIPT="$MY_DIR/lib/ansible_inventory.rb"
which $ANSIBLE_PLAYBOOK_BIN &> /dev/null
if [ $? -ne 0 ]; then
error "Could not find '$ANSIBLE_PLAYBOOK_BIN'"
warn "Please install Ansible according to http://www.ansibleworks.com/docs/intro_installation.html"
warn "and then re-run ${MYSELF}"
exit 1
fi
$ANSIBLE_PLAYBOOK_BIN -i $EXTERNAL_INVENTORY_SCRIPT "$@"