-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·68 lines (54 loc) · 1.33 KB
/
build.sh
File metadata and controls
executable file
·68 lines (54 loc) · 1.33 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/usr/bin/env bash
PROGNAME=$0
usage() {
cat << EOF >&2
This script will initiate ansible provisioning to build a dev environment.
Usage: $PROGNAME [-h,--help] [-s,--skip-roles]
-h, --help: This information.
-s, --skip-roles: Don't reinstall ansible roles via galaxy
EOF
exit 1
}
skip_roles() {
SKIPROLES=yes
}
# Transform long options to short ones
for arg in "$@"; do
shift
case "$arg" in
"--help") set -- "$@" "-h" ;;
"--skip-roles") set -- "$@" "-s" ;;
*) set -- "$@" "$arg"
esac
done
while getopts hs o; do
case $o in
h) usage;;
s) skip_roles;;
*) usage
esac
done
shift "$((OPTIND - 1))"
echo "Welcome to the development environment provisioner! Let's get started."
echo
if [[ -e /usr/bin/ansible ]]
then
echo "Ansible already installed."
echo
else
echo "Installing Ansible..."
sudo apt update
sudo apt install software-properties-common
sudo apt-add-repository --yes --update ppa:ansible/ansible
sudo apt -y install ansible
fi
PROJECT_ROOT=$PWD
echo "Determine Windows user directory"
cd /mnt/c
export WINHOME=$(cmd.exe /C "cd /D %USERPROFILE% && bash.exe -c pwd")
echo "[ $WINHOME ]"
cd $PROJECT_ROOT
echo
echo "Starting provisioning ..."
echo
ansible-playbook --connection="local 127.0.0.1" ./playbook.yml --extra-vars "skip_roles=$SKIPROLES"