-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.tftpl
44 lines (35 loc) · 1.64 KB
/
setup.tftpl
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
#!/bin/bash -x
set -e
set -u
set -x
cd /root || exit 1
function install_azcli_from_internet() {
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
az login --identity >/dev/null
}
function install_azcli() {
command -v az || install_azcli_from_internet
}
function install_agent_and_periodic_db_query_cronjob() {
if [ ! -d "${agent_installation_dir}/ragent" ]; then
echo "Downloading agent:"
az storage blob download --account-name ${az_storage_account} --container-name ${az_container} --name ${az_blob} --file ./${az_blob} --auth-mode login >/dev/null
chmod +x ./${az_blob}
echo "Installing agent:"
./${az_blob} -n -d ${agent_installation_dir}
rm ${az_blob}
echo "Registering agent:"
${agent_installation_dir}/ragent/bin/cli --dcfg ${agent_installation_dir}/ragent/etc --dtarget ${agent_installation_dir}/ragent/etc --dlog ${agent_installation_dir}/ragent/etc/logs/cli registration advanced-register registration-type=Primary is-db-agent=true tunnel-protocol=TCP gw-ip=${agent_gateway_host} gw-port=443 manual-settings-activation=Automatic monitor-network-channels=Both password="${secure_password}" ragent-name="${agent_name}" site='${site}' server-group="${server_group}";
echo "Starting agent:"
${agent_installation_dir}/ragent/bin/rainit start;
echo "Run database queries:"
${database_queries_commands}
else
echo "Agent installation directory already exists, skipping agent installation.."
fi
}
${package_install}
echo "Installing database:"
${database_installation_commands}
install_azcli
install_agent_and_periodic_db_query_cronjob