2020-09-14 03:52:49 +02:00
|
|
|
#!/usr/local/bin/execlineb -P
|
2025-01-04 03:36:17 +01:00
|
|
|
# {{ ansible_managed }}
|
2020-09-14 03:52:49 +02:00
|
|
|
|
|
|
|
s6-envdir ./env
|
|
|
|
multisubstitute {
|
2025-01-04 03:36:17 +01:00
|
|
|
importas -i -u NAME NAME
|
2020-09-14 03:52:49 +02:00
|
|
|
importas -i -u -s ORDER ORDER
|
|
|
|
importas -i -u RAM RAM
|
|
|
|
importas -i -u ROM ROM
|
|
|
|
importas -i -u CPUS CPUS
|
|
|
|
importas -i -u NIC NIC
|
|
|
|
importas -i -u COM COM
|
|
|
|
importas -i -u PORT PORT
|
|
|
|
importas -i -u PASS PASS
|
|
|
|
}
|
|
|
|
|
|
|
|
backtick -n AHCI {
|
2025-01-04 03:36:17 +01:00
|
|
|
forx X { $ORDER }
|
2020-09-14 03:52:49 +02:00
|
|
|
importas X X
|
|
|
|
importas Y $X
|
|
|
|
echo -n ,$Y
|
|
|
|
}
|
|
|
|
importas -i -u AHCI AHCI
|
|
|
|
|
|
|
|
foreground { if { test -e "/dev/vmm/${NAME}" } bhyvectl --vm="${NAME}" --destroy }
|
|
|
|
foreground { /etc/rc.d/netif start "${NIC}" }
|
|
|
|
foreground { fdmove -c 1 2 echo "bhyve-${NAME}: Starting VM ${NAME} with ${CPUS} CPUs, ${RAM} RAM, COM on ${COM}, NIC ${NIC} and VNC port ${PORT}." }
|
|
|
|
|
|
|
|
s6-notifyoncheck -d -w 100 -n 70
|
|
|
|
|
|
|
|
fdmove -c 2 1
|
2025-01-04 03:45:26 +01:00
|
|
|
bhyve -c "{{ item.0.cpus }}" -m "{{ item.0.ram }}" -w -A -P -H
|
2025-01-04 03:36:17 +01:00
|
|
|
-s "0,amd_hostbridge"
|
|
|
|
-s "2:0,ahci${AHCI}"
|
|
|
|
-s "3,virtio-net,${NIC}"
|
|
|
|
-s "4,virtio-rnd"
|
|
|
|
{% for disk in item.0.disks if disk.virtio|default(False) -%}
|
2025-01-04 04:02:23 +01:00
|
|
|
-s "{{ disk.virtio_slot }},virtio-blk,/dev/zvol/{{ bhyve_pool }}/bhyve/guests/{{ item.0.name }}/{{ disk.name }}"
|
2025-01-04 03:36:17 +01:00
|
|
|
{% endfor -%}
|
|
|
|
{% if item.0.password is defined -%}
|
|
|
|
-s "29,fbuf,tcp=[::1]:${PORT},w=800,h=600,password=${PASS}"
|
|
|
|
{% endif -%}
|
|
|
|
-s "31,lpc"
|
|
|
|
-l "com1,/dev/${COM}"
|
|
|
|
-l "bootrom,${ROM}"
|
2025-01-04 04:20:41 +01:00
|
|
|
"${NAME}"
|