-
Notifications
You must be signed in to change notification settings - Fork 0
/
provision-localhost.sh
executable file
·59 lines (48 loc) · 1.26 KB
/
provision-localhost.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
58
59
#!/bin/bash
OPTIND=1 # Reset in case getopts has been used previously in the shell.
function show_help {
echo Provision your PopOS or fedora desktops
echo
echo OPTIONS:
echo " -p Skip Package Manager Updates (does not disable updates from roles)"
echo " -r Skip Role Definition Updates"
echo " -s Skip Snap Package Install/Updates (useful if store is down)"
}
# Function to add or update the skip tag list
function add_skip_tag {
if [ -z ${skip_tags} ]; then
skip_tags="$1"
else
skip_tags="$skip_tags,$1"
fi
}
while getopts "hprs" opt; do
case "$opt" in
h)
show_help
exit 0
;;
p)
add_skip_tag "pkg_update"
;;
r)
role_updates="skip"
;;
s)
add_skip_tag "snap_pkgs"
;;
esac
done
shift $((OPTIND-1))
[ "${1:-}" = "--" ] && shift
DIRNAME=`dirname "$0"`
LOCAL_USER=${USER}
# Determine skip tags
if [ ! -z ${skip_tags} ]; then
skip_tag_directive="--skip-tags $skip_tags"
fi
#Update roles if not skipped
if [ ! "$role_updates" == "skip" ]; then
ansible-galaxy install -f -r requirements.yaml
fi
sudo ansible-playbook provision.yaml -v --extra-vars="for_user=${LOCAL_USER}" ${skip_tag_directive}