machine_setup/ansible/roles/bhyve/tasks/freebsd.yaml
2022-11-01 20:30:07 -04:00

55 lines
1.3 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:
- vm-bhyve
- tmux # for interactive consoles
- bhyve-firmware # For UEFI
state: present
- name: Create zfs dataset
zfs:
name: "{{ bhyve_dataset }}"
state: present
extra_zfs_properties:
mountpoint: "{{ bhyve_mountpoint }}"
canmount: "noauto"
"ta:bemount": "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"
- 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"