49 lines
1.2 KiB
YAML
49 lines
1.2 KiB
YAML
#
|
|
# Create a new VM:
|
|
# vm iso 'http://mirror.clarkson.edu/archlinux/iso/2022.01.01/archlinux-2022.01.01-x86_64.iso'
|
|
# vm create -t arch -s 50G testvm
|
|
# vm install testvm 'archlinux-2022.01.01-x86_64.iso'
|
|
#
|
|
#
|
|
- name: Install packages
|
|
package:
|
|
name:
|
|
- tmux # for interactive consoles
|
|
- bhyve-firmware # For UEFI
|
|
state: present
|
|
|
|
- name: Install scripts
|
|
copy:
|
|
src: "files/{{ item.src }}"
|
|
dest: "{{ item.dest }}"
|
|
mode: 0755
|
|
owner: root
|
|
group: wheel
|
|
loop:
|
|
- src: bhyve_netgraph_bridge.bash
|
|
dest: /usr/local/bin/bhyve_netgraph_bridge
|
|
|
|
- name: Create zfs dataset
|
|
zfs:
|
|
name: "{{ bhyve_dataset }}"
|
|
state: present
|
|
extra_zfs_properties:
|
|
mountpoint: "{{ bhyve_mountpoint }}"
|
|
canmount: "{{ bhyve_canmount|default('noauto') }}"
|
|
"ta:bemount": "{{ bhyve_bemount|default('on') }}"
|
|
|
|
- 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"
|