forked from sei-noconnor/k3s-production
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup
executable file
·61 lines (55 loc) · 1.91 KB
/
setup
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
#!/bin/bash -xe
# Change to the current directory
directory="$(dirname "${BASH_SOURCE[0]}")"
cd $directory
source $directory/scripts/utils
import_vars $directory/env
#Dynamic variables
export BASE_IP=$(echo $DEFAULT_NETWORK |cut -d"." -f1-3)
# Replace variables in files
replace_vars $directory/common '.*\.(json|conf|yaml|yml)'
replace_vars $directory/crucible '.*\.(json|conf|yaml|yml|sql)'
replace_vars $directory/k3s-ansible '.*\.(json|conf|yaml|yml)'
replace_vars $directory/terraform '.*\.(json|conf|yaml|yml|auto.tfvars)'
replace_vars $directory/values '.*\.(json|conf|yaml|yml)'
replace_vars $directory/crucible/setup-gitlab
chmod +x $directory/crucible/setup-gitlab
replace_vars $directory/scripts/identity-seed.example.sh
chmod +x $directory/scripts/identity-seed.example.sh
replace_vars $directory/crucible/import-content
chmod +x $directory/crucible/import-content
echo "Pausing for 10 Seconds to cancel execution"
sleep 10
if [[ $GENERATE_CERTS = true ]]; then
$directory/common/certs/generate-certs.sh
# reset, so we don't clobber
sed -i '' -e "s/GENERATE_CERTS=.*/GENERATE_CERTS=false/" env
fi
if [[ $IMPORT_CERTS = true ]]; then
import_root_ca $directory/common/certs/root-ca.pem
sed -i '' -e "s/IMPORT_CERTS=.*/IMPORT_CERTS=false/" env
fi
if [[ $RUN_TERRAFOM = true ]]; then
# TODO
echo "Future Automation"
fi
if [[ $RUN_ANSIBLE = true ]]; then
# TODO
echo "Future Automation"
fi
# Always run common apps.
apps="common,$1"
IFS=',' read -a stacks <<< $apps
echo "The following apps will be installed ${stacks[@]}"
for stack in ${stacks[@]}; do
replace_vars $directory/$stack/setup-$stack
chmod +x $directory/$stack/setup-$stack
echo "Installing $stack with script located at $directory/$stack/setup-$stack"
$directory/$stack/setup-$stack
sleep 15
done
if [[ $IMPORT_CONTENT = true ]]; then
# TODO
$directory/crucible/import-content
sed -i '' -e "s/IMPORT_CONTENT=.*/IMPORT_CONTENT=false/" env
fi