Permalink
Switch branches/tags
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
38 lines (34 sloc) 679 Bytes
#!/bin/bash
if [ $# -ne 1 ]; then
echo "Usage: $0 (start|stop|reload)"
exit 1
fi
VBMC="/usr/bin/vbmc"
{% for node in vms %}
$VBMC show {{node.name}} > /dev/null 2>&1
if [ $? -ne 0 ]; then
$VBMC add \
--libvirt-uri qemu:///system \
--username ADMIN \
--password ADMIN \
--port 112{{node.interfaces.0.mac|replace('24:42:53:21:52:','')}} \
{{node.name}}
fi
{% endfor %}
case $1 in
start|stop)
{% for node in vms %}
$VBMC $1 {{node.name}}
{% endfor %}
;;
reload)
{% for node in vms %}
$VBMC stop {{node.name}}
$VBMC start {{node.name}}
{% endfor %}
;;
*)
echo "Usage: $0 (start|stop)"
exit 2
;;
esac