forked from andif888/azure-playground
-
Notifications
You must be signed in to change notification settings - Fork 0
/
apply__core.sh
executable file
·190 lines (147 loc) · 4.87 KB
/
apply__core.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
#!/bin/bash
set -e
current_dir=$(pwd)
script_name=$(basename "${BASH_SOURCE[0]}")
script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
environment=$(basename $script_dir)
build_path_terraform=$script_dir/terraform
build_path_ansible=$script_dir/ansible
# thread1
echo "creating 01_rg"
cd $build_path_terraform/01_rg && ./build.sh
# thread2 -> depends_on: thread1
echo "creating 02_network"
cd $build_path_terraform/02_network && ./build.sh &
thread2=$!
# thread3 -> depends_on: thread1
echo "creating 03_storage"
cd $build_path_terraform/03_storage && ./build.sh &
thread3=$!
echo "waiting for thread2 (network)..."
wait $thread2
echo "thread2 (network) exited with $?"
echo "waiting for thread3 (storage)..."
wait $thread3
echo "thread3 (storage) exited with $?"
# thread4 -> depends_on: thread2 && thread3
echo "creating 04_wg"
cd $build_path_terraform/04_wg && ./build.sh &
thread4=$!
# thread5 -> depends_on: thread2 && thread3
echo "creating 05_dc"
cd $build_path_terraform/05_dc && ./build.sh &
thread5=$!
# thread7 -> depends_on: thread2 && thread3
#echo "creating 07_rdg"
#cd $build_path_terraform/07_rdg && ./build.sh &
#thread7=$!
# thread8 -> depends_on: thread2 && thread3
#echo "creating 08_dbfs"
#cd $build_path_terraform/08_dbfs && ./build.sh &
#thread8=$!
#echo "waiting for thread4 (wg)..."
wait $thread4
echo "thread4 (wg) exited with $?"
echo "waiting for thread5 (dc)..."
wait $thread5
echo "thread5 (dc) exited with $?"
[ "$vms_already_alive" = true ] || (echo "wait 5 minutes to VM provisioning ..."; sleep 5m)
# thread9 -> depends_on thread4 and thread5
echo "provisioning with ansible"
cd $build_path_ansible \
&& ./requirements_download.sh \
&& ansible-playbook -i inventory generic-dc.yml &
thread9=$!
#echo "waiting for thread7 (rdg)..."
#wait $thread7
#echo "thread7 (rdg) exited with $?"
#echo "waiting for thread8 (dbfs)..."
#wait $thread8
#echo "thread8 (dbfs) exited with $?"
echo "waiting for thread9 (generic-dc)..."
wait $thread9
echo "thread9 (generic-dc) exited with $?"
# thread10 -> depends_on thread9
cd $build_path_ansible \
&& ansible-playbook -i inventory generic-ca.yml \
&& ansible-playbook -i inventory infra-dc.yml &
thread10=$!
# thread11
#cd $build_path_ansible \
#&& ansible-playbook -i inventory infra-dh.yml \
#&& ansible-playbook -i inventory infra-dh-containers.yml &
#thread11=$!
# thread13
#cd $build_path_ansible \
#&& ansible-playbook -i inventory generic-domain-members.yml &
#thread13=$!
#echo "waiting for thread13 (generic-domain-members)..."
#wait $thread13
#echo "thread13 (generic-domain-members) exited with $?"
# thread14
#cd $build_path_ansible \
#&& ansible-playbook -i inventory generic-rdcb.yml \
#&& ansible-playbook -i inventory generic-rdg.yml \
#&& ansible-playbook -i inventory infra-mgmt-tools.yml &
#thread14=$!
# thread15
#cd $build_path_ansible \
#&& ansible-playbook -i inventory generic-fs.yml \
#&& ansible-playbook -i inventory infra-fs.yml \
#&& ansible-playbook -i inventory infra-sqldev.yml &
#thread15=$!
#echo "waiting for thread11 (infra-dh-containers)..."
#wait $thread11
#echo "thread11 (infra-dh-containers) exited with $?"
#echo "waiting for thread14 (generic-rdg)..."
#wait $thread14
#echo "thread14 (generic-rdg) exited with $?"
# thread16
#cd $build_path_ansible \
#&& ansible-playbook -i inventory final-infra-dh-guac-connection-lists.yml &
#thread16=$!
# thread17
#cd $build_path_ansible \
#&& ansible-playbook -i inventory infra-rdg-certificates.yml &
#thread17=$!
#echo "waiting for thread10 (infra-dc)..."
#wait $thread10
#echo "thread10 (infra-dc) exited with $?"
#echo "waiting for thread15 (generic-fs)..."
#wait $thread15
#echo "thread15 (generic-fs) exited with $?"
#echo "waiting for thread17 (infra-rdg-certificates)..."
#wait $thread17
#echo "thread17 (infra-rdg-certificates) exited with $?"
# thread18
#cd $build_path_ansible \
#&& ansible-playbook -i inventory final-local-doc.yml &
#thread18=$!
# thread19
#cd $build_path_ansible \
#&& ansible-playbook -i inventory infra-windows-international.yml &
#thread19=$!
# thread20
#cd $build_path_ansible \
#&& ansible-playbook -i inventory final-windows-doc.yml &
#thread20=$!
#echo "waiting for thread16 (infra-dh-guac-connections)..."
#wait $thread16
#echo "thread16 (infra-dh-guac-connections) exited with $?"
#echo "waiting for thread19 (infra-windows-international)..."
#wait $thread19
#echo "thread19 (infra-windows-international) exited with $?"
#echo "waiting for thread20 (final-windows-doc)..."
#wait $thread20
#echo "thread20 (final-windows-doc) exited with $?"
# thread21
#cd $build_path_ansible \
#&& ansible-playbook -i inventory azure-network-dns-servers.yml \
#&& ansible-playbook -i inventory generic-linux-reboot.yml &
#thread21=$!
#echo "waiting for thread18 (final-local-doc)..."
#wait $thread18
#echo "thread18 (final-local-doc) exited with $?"
#echo "waiting for thread21 (reboot)..."
#wait $thread21
#echo "thread21 (reboot) exited with $?"