#
# 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') }}"
