-
Notifications
You must be signed in to change notification settings - Fork 55
Expand file tree
/
Copy pathsetup-sut-docker.sh
More file actions
executable file
·80 lines (73 loc) · 2.58 KB
/
setup-sut-docker.sh
File metadata and controls
executable file
·80 lines (73 loc) · 2.58 KB
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
#!/bin/bash -e
#
# Apache v2 license
# Copyright (C) 2023 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
DIR="$( cd "$( dirname "$0" )" &> /dev/null && pwd )"
. "$DIR"/setup-common.sh
print_help () {
echo "Usage: [options] <user@ip>"
echo ""
echo "--port port Specify the SSH port."
echo "--nointelcert Do not install Intel certificates."
echo "--no-password Do not ask for password. Use DEV_SUDO_PASSWORD, SUT_SSH_PASSWORD and/or SUT_SUDO_PASSWORD instead."
echo "--worker Specify a worker vm_group."
echo "--client Specify a client vm_group."
echo "--controller Specify a controller vm_group."
echo "--sut <file>[:#slices] Specify the sut configuration file."
echo ""
exit 3
}
if [ ${#@} -lt 1 ]; then
print_help
fi
parse_host_args "${@}"
ansible_options=(
'-e' 'docker_reset=true'
)
[ ! -e vars.yaml ] || ansible_options+=(-e "@vars.yaml")
setup_ansible_options=()
setup_native_options=()
last=""
for v in "${args[@]}"; do
k1="$(echo "${v#--}" | cut -f1 -d=)"
v1="$(echo "${v#--}" | cut -f2- -d= | sed 's/%20/ /g')"
case "$v" in
--nointelcert)
setup_native_options+=("$v")
;;
--no-password)
setup_ansible_options+=("$v")
setup_native_options+=("$v")
;;
--*=*)
validate_ansible_option $k1 $v
setup_native_options+=("$v")
ansible_options+=("-e" "$k1=$v1")
;;
--no*)
validate_ansible_option ${k1#no} $v
setup_native_options+=("$v")
ansible_options+=("-e" "${k1#no}=false")
;;
--*)
validate_ansible_option $k1 $v
setup_native_options+=("$v")
ansible_options+=("-e" "$k1=true")
;;
*)
echo "Unsupported argument: $v"
exit 3
;;
esac
last="$v"
done
./setup-ansible.sh "${setup_ansible_options[@]}" 2>&1 | tee setup-sut-docker.logs
./setup-sut-native.sh --port $ssh_port --worker "${worker_hosts[@]}" --client "${client_hosts[@]}" --controller "${controller_hosts[@]}" "${setup_native_options[@]}" 2>&1 | tee -a setup-sut-docker.logs
. <(sed '/^# BEGIN WSF Setup/,/^# END WSF Setup/{d}' /etc/environment) > /dev/null
export http_proxy https_proxy no_proxy
rm -f /tmp/wsf-setup-ssh-* 2> /dev/null || true
ANSIBLE_ROLES_PATH=../terraform/template/ansible/docker/roles:../terraform/template/ansible/common/roles:../terraform/template/ansible/traces/roles ANSIBLE_INVENTORY_ENABLED=yaml ansible-playbook -vv -e mysut_config_name="$sutname" -e wl_logs_dir="$DIR" -e compose=true -e my_ip_list=1.1.1.1 "${ansible_options[@]}" --inventory <(create_inventory) ./setup-sut-docker.yaml 2>&1 | tee -a setup-sut-docker.logs
rm -f timing.yam
show_tf_file 2>&1 | tee -a setup-sut-docker.logs