commit - 2a40c74e5924bdd018867ee33003061ed22fc678
commit + 682ffcc16485cefe8f9982b0e8946303f51fe8e0
blob - 1666cfcc241f9a28f865eb97a0cb45e30d9475b4
blob + bad7045669c0b87f9a7678c7c8eb3a47b20c912b
--- _vms.conf
+++ _vms.conf
VMDUSERS="_vmdusers"
UPLINK="uplink_vlan42"
BRIDGE="bridge42"
+UPLINK2="uplink_vlan421"
+BRIDGE2="bridge421"
# dhcpd.conf
ROUTER="192.168.1.1"
DNS="192.186.1.3"
blob - 037cba59eb0e19165c8d34f4c0f8291321c6636f
blob + 4a6cdf965f4ebfb00ff8bb56045748491a8b5a2e
--- deploy.sh
+++ deploy.sh
echo "${1}:${2}"
}
+fetch_switch() {
+ # Fetch the uplink for the VM.
+ # Takes the UPLINK and switch.
+ # print the switch
+ if test -z "$2"
+ then echo $1
+ else echo $2
+ fi
+}
+
fetch_ip() {
# Fetch the IP address for the VM.
- # Takes the IP_PREFIX, IP_START and VM#.
+ # Takes the IP_PREFIX, IP_START, VM# and ip.
# add IP_START and VM# and print the IP address
# print the IP address
- _prefix=$1
- _host=$(($2 + $3))
- echo "${_prefix}.${_host}"
+ if test -z "$4"
+ then
+ _prefix=$1
+ _host=$(($2 + $3))
+ echo "${_prefix}.${_host}"
+ else echo "$4"
+ fi
}
fetch_ipv6() {
# Fetch the IPv6 address of the VM.
- # Takes the IPV6_PREFIX, IPV6_START, IP_START and VM#
+ # Takes the IPV6_PREFIX, IPV6_START, IP_START, VM# and ipv6.
# add IPV6_START and VM#, IP_START and VM# and print the IPv6 address
# print the IPv6 address
- _prefix=$1
- _subnet=$(($2 + $4))
- _host=$(($3 + $4))
- echo "${_prefix}:${_subnet}::${_host}"
+ if test -z "$5"
+ then
+ _prefix=$1
+ _subnet=$(($2 + $4))
+ _host=$(($3 + $4))
+ echo "${_prefix}:${_subnet}::${_host}"
+ else echo "$5"
+ fi
}
generate_passwd() {
unset email
unset message
unset hostname
+ unset ip
+ unset ipv6
unset username
unset note
}
printf "switch \"%s\" {\\n" "$UPLINK"
printf "\\tinterface %s\\n" "$BRIDGE"
printf "}\\n\\n"
+ if ! test -z "$UPLINK2"
+ then
+ printf "switch \"%s\" {\\n" "$UPLINK2"
+ printf "\\tinterface %s\\n" "$BRIDGE2"
+ printf "}\\n\\n"
+ fi
while read -r f
do
. "$f"
fi
printf "\\tdisk \"%s/%s.img\"\\n" "$IMAGES" "$_instance"
printf "\\tinterface tap {\\n"
- printf "\\t\\tswitch \"uplink_vlan921\"\\n"
+ #printf "\\t\\tswitch \"uplink_vlan921\"\\n"
+ printf "\\t\\tswitch \"$(fetch_switch "$UPLINK" "$switch")\"\\n"
printf "\\t\\tlladdr %s\\n" "$(fetch_mac "$MAC_PREFIX" "$(find_vm "$VMS" "$_instance")")"
printf "\\t}\\n"
printf "}\\n"
_instance=$(check_instance "$f" "$instance")
printf "\\thost %s {\\n" "$_instance"
printf "\\t\\thardware ethernet %s;\\n" "$(fetch_mac "$MAC_PREFIX" "$(find_vm "$VMS" "$_instance")")"
- printf "\\t\\tfixed-address %s;\\n" "$(fetch_ip "$IP_PREFIX" "$IP_START" "$(find_vm "$VMS" "$_instance")")"
+ printf "\\t\\tfixed-address %s;\\n" "$(fetch_ip "$IP_PREFIX" "$IP_START" "$(find_vm "$VMS" "$_instance")" "$ip")"
if ! test -f "${IMAGES}/${_instance}.img"
then printf "\\t\\tfilename \"auto_install\";\\n"
else printf "\\t\\tfilename \"auto_upgrade\";\\n"
. "$f"
_instance=$(check_instance "$f" "$instance")
_pass="$(generate_passwd)"
- _ipv6=$(fetch_ipv6 "$IPV6_PREFIX" "$IPV6_START" "$IP_START" "$(find_vm "$VMS" "$_instance")")
+ _ipv6=$(fetch_ipv6 "$IPV6_PREFIX" "$IPV6_START" "$IP_START" "$(find_vm "$VMS" "$_instance")" "$ipv6")
_ipv6_gateway=$(echo "$_ipv6" | sed -e 's/::[0-9]*$/::1/g')
_mac=$(fetch_mac "$MAC_PREFIX" "$(find_vm "$VMS" "$_instance")")
if ! test -f "${IMAGES}/${_instance}.img"
blob - 9e865e50d02e38a2a095bfc1787cbf4125cee011
blob + 827b073940d5958346876dd490768ccf9c36a1bc
--- vms/vm10.txt
+++ vms/vm10.txt
name="User Ten"
email="user.ten@gmail.com"
message="ssh-ed25519 AAAAC3NzaC1lAILmSludIBvFRhkxldn1OEgnQdrNd7PxMQjm2DyYCqHjy super-special-key"
+switch="uplink_vlan421"
+ip="46.23.92.101"
hostname="vmten"
username="userten"
note="This is all awesome!!"