Configure bhyve.

This commit is contained in:
Tom Alexander 2022-11-01 19:06:44 -04:00
parent fbfadadffc
commit a344c92d83
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
4 changed files with 50 additions and 0 deletions

View File

@ -45,3 +45,4 @@ jail_list:
conf: conf:
src: dagger src: dagger
bhyve_dataset: zroot/freebsd/release/vm bhyve_dataset: zroot/freebsd/release/vm
bhyve_list: []

View File

@ -1 +1,2 @@
bhyve_mountpoint: "/vm" bhyve_mountpoint: "/vm"
bhyve_list: []

View File

@ -0,0 +1,17 @@
# Use UEFI when booting from a disk
loader="uefi"
graphics="yes"
xhci_mouse="yes"
graphics_listen="127.0.0.1"
#graphics_listen="10.216.1.1"
graphics_res="1920x1080"
#prestart=""
cpu=1
memory=1024M
network0_type="virtio-net"
network0_switch="customswitch"
disk0_type="virtio-blk"
disk0_name="disk0"
disk0_dev="sparse-zvol"
virt_random="yes" # virtio-rnd

View File

@ -20,3 +20,34 @@
state: present state: present
extra_zfs_properties: extra_zfs_properties:
mountpoint: "{{ bhyve_mountpoint }}" mountpoint: "{{ bhyve_mountpoint }}"
- name: Enable bhyve
community.general.sysrc:
name: "{{ item.name }}"
value: "{{ item.value }}"
path: /etc/rc.conf.d/vm
loop:
- name: vm_enable
value: "YES"
- name: vm_dir
value: "zfs:{{ bhyve_dataset }}"
- name: vm_list
value: "{{ bhyve_list|community.general.json_query('[?enabled==`true`].name')|join(' ') }}"
- name: vm_delay
value: "5"
- name: init vm-bhyve
command: vm init
args:
creates: "{{ bhyve_mountpoint }}/.templates"
- name: Install Configuration
copy:
src: "files/{{ item.src }}"
dest: "{{ item.dest }}"
mode: 0644
owner: root
group: wheel
loop:
- src: arch.conf
dest: "{{ bhyve_mountpoint }}/.templates/arch.conf"