-
Notifications
You must be signed in to change notification settings - Fork 0
/
provision
executable file
·42 lines (40 loc) · 1.13 KB
/
provision
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
32
33
34
35
36
37
38
39
40
41
42
#!/bin/bash
ap=$(which ansible-playbook 2>/dev/null)
ansible=$(which ansible 2>/dev/null)
[ $? -ne 0 ] && echo "Cannot find ansible executables" && exit 1
debug=""
dump=false
while getopts ":hdD" opt; do
case $opt in
h)
echo "usage: $(basename $0) [-h] [-D] [-d]"
echo
echo "-D: dump vars"
echo "-h: print this help"
echo "-t: add a tag to run"
echo "-T: replace tag list"
echo "default tags: $tags"
exit 0
;;
d)
debug="-vvv"
shift;
;;
D)
dump=true
shift;
;;
:)
echo "Option -$OPTARG requires an argument." >&2
exit 1
;;
esac
done
vagrant status | grep -q "running" || vagrant up
if $dump; then
cmd="$ansible buildsquad -u vagrant --sudo --private-key ~/.vagrant.d/insecure_private_key -m setup -i provisioning.ansible.hosts"
else
cmd="$ap -i provisioning.ansible.hosts provisioning.playbook.yml -u vagrant -s --private-key=~/.vagrant.d/insecure_private_key $debug $@"
fi
[ -z $debug ] || echo $cmd
$cmd