forked from avojak/elementary-os-config
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.sh
executable file
·49 lines (42 loc) · 793 Bytes
/
run.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
#!/bin/bash
#if [ "$EUID" -ne 0 ]; then
# echo "Must run as root!"
# exit 1
#fi
POSITIONAL=()
while [[ $# -gt 0 ]]; do
key="$1"
case $key in
-h|--help)
HELP=1
shift
;;
--vm-mode)
VM_MODE=1
shift
;;
*)
HELP=0
VM_MODE=0
shift
;;
esac
done
if [[ "$HELP" -eq 1 ]]; then
echo "usage: ./run.sh [--vm-mode]"
exit 0
fi
# Install Ansible
sudo apt install -y ansible
# Install Ansible Galaxy roles
ansible-galaxy install -r ansible/requirements.yml
if [[ "$VM_MODE" -eq 1 ]]; then
echo "Running in VM mode..."
ansible-playbook ansible/vm-playbook.yml -i ansible/hosts
else
echo "Running in non-VM mode..."
ansible-playbook ansible/playbook.yml -i ansible/hosts
fi
if [[ "$?" -eq 0 ]]; then
neofetch
fi