-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathgenerate_vcf_version_file.sh
executable file
·112 lines (91 loc) · 2.25 KB
/
generate_vcf_version_file.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
#!/bin/bash
source ./env
source ./govc_env
source ./compute/cpod-xxx_env
source ./extra/functions.sh
echo "enter name for new cpod version file (vspherexxx.sh)"
read filename
cat << EOF > ${filename}
#!/bin/bash
# source this env file and
# create cPod with: cpodctl create X 3 [you-name]
EOF
# select ESX template
echo
echo "Select ESX Template"
echo
TEMPLATES=$(govc ls /${VCENTER_DATACENTER}/vm/${TEMPLATE_FOLDER} |grep ESX | rev | cut -d"/" -f1 |rev )
TEMPLATES=${TEMPLATES}" Quit"
select TEMPLATE in ${TEMPLATES}; do
if [ "${TEMPLATE}" = "Quit" ]; then
exit
fi
echo "you selected version : ${TEMPLATE}"
echo "export TEMPLATE_ESX=${TEMPLATE}" >> ${filename}
break
done
# select VCSA OVA
echo
echo "Select Cloudbuilder OVA"
echo
OVAS=$(ls ${BITS}/VMware-Cloud-Builder-*)
OVAS=${OVAS}" None"
select OVA in ${OVAS}; do
if [ "${OVA}" = "None" ]; then
exit
fi
echo "you selected version : ${OVA}"
echo "export OVA_CLOUDBUILDER=${OVA}" >> ${filename}
break
done
VCF_VERSION=$(echo "${OVA}" |sed 's/.*\///' | sed 's/VMware-Cloud-Builder-//' | cut -d "." -f1)
echo
echo "Select JSON template"
echo
JSONS=$(ls ./compute/cloudbuilder-*.json | rev | cut -d "/" -f1 | rev)
JSONS=${JSONS}" None"
select JSON in ${JSONS}; do
if [ "${JSON}" = "None" ]; then
break
fi
echo "you selected version : ${JSON}"
echo "export JSON_TEMPLATE=${JSON}" >> ${filename}
echo "export EMS_TEMPLATE=${JSON}" >> ${filename}
break
done
echo "export NOCUSTO='YES'" >> ${filename}
#get licenses
apply_license(){
echo "export LIC_ESX=${ESX_KEY}" >> ${filename}
echo "export LIC_VCSA=${VCENTER_KEY}" >> ${filename}
echo "export LIC_VSAN=${VSAN_KEY}" >> ${filename}
echo "export LIC_NSXT=${LIC_NSXT}" >> ${filename}
}
case $VCF_VERSION in
4)
check_license_file "V7"
echo "Applying Version 7"
VCENTER_KEY=$V7_VCENTER_KEY
ESX_KEY=$V7_ESX_KEY
VSAN_KEY=$V7_VSAN_KEY
#NSXT_KEY
apply_license
;;
5)
check_license_file "V8"
echo "Applying Version 8"
VCENTER_KEY=$V8_VCENTER_KEY
ESX_KEY=$V8_ESX_KEY
VSAN_KEY=$V8_VSAN_KEY
#NSXT_KEY
apply_license
;;
*)
echo "Version $VCF_VERSION not foreseen yet by script"
;;
esac
echo
echo "Done"
cat ${filename}