-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathrunplaybook.sh
executable file
·57 lines (47 loc) · 1.17 KB
/
runplaybook.sh
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
#!/bin/sh
echo "entering"
if [ "$(id -u)" -ne 0 ]; then
echo 'This script must be run by root' >&2
exit 1
fi
# A POSIX variable
OPTIND=1 # Reset in case getopts has been used previously in the shell.
# Initialize our own variables:
force=0
extensions=0
skipansible=0
echo "getopts"
while getopts "fes" opt; do
case "$opt" in
f) force=1
;;
e) extensions=1
;;
s) skipansible=1
;;
**) ;;
esac
done
shift $((OPTIND-1))
[ "${1:-}" = "--" ] && shift
echo "skipansible ${skipansible}"
if [ $skipansible = 0 ]; then
echo "running ansible"
if [ $force = 1 ]; then
echo "forcing requirements"
ansible-galaxy install -r ./requirements.yml --force
else
echo "installing requirements"
ansible-galaxy install -r ./requirements.yml
fi
ansible-playbook playbook.yml --connection=local
fi
echo "extensions flag: ${extensions}"
if [ $extensions = 1 ]; then
echo "Cloning VsCode Extensions"
git clone https://github.com/esdc-devx/vscode
echo "Backing up existing extensions"
code --list-extensions | sort -o vscode.bak.ext
echo "Installing extensions"
./vscode/install.sh ./vscode/vscode.ext
fi