aboutsummaryrefslogtreecommitdiffhomepage
path: root/ubuntu12.04-onbuild/ansible-playbook-wrapper
blob: bf137c814c69ac515e0f111688fd50b8a204e08d (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
27
28
29
30
#!/bin/sh
#
# Simple wrapper for executing ansible-playbook with local connection.
#
# USAGE:
#    ansible-playbook-wrapper  [other ansible-playbook arguments]
#
# ENVIRONMENT VARIABLES:
# 
#    - PLAYBOOK: playbook filename;   default = "playbook.yml"
#    - INVENTORY: inventory filename; default = "/etc/ansible/hosts"
# 


if [ -z "$PLAYBOOK" ]; then
    PLAYBOOK=playbook.yml
fi


if [ -z "$INVENTORY" ]; then
    exec ansible-playbook        \
       $PLAYBOOK                 \
       --connection=local        \
       "$@"
else
    exec ansible-playbook        \
       -i $INVENTORY  $PLAYBOOK  \
       --connection=local        \
       "$@"
fi