---
- hosts: all
  user: root
  gather_facts: no
  tasks:
    - name: "kenv smbios.system.product"
      shell: kenv smbios.system.product || true
      register: system_product

    - name: "kenv smbios.bios.vendor"
      shell: kenv smbios.bios.vendor || true
      register: bios_vendor

    - name: "VirtualBox configuration"
      lineinfile: >
        dest=/etc/rc.conf
        line="{{item}}_enable=\"YES\""
        regexp="^{{item}}_enable"
        insertafter=EOF
      with_items:
        - vboxguest
        - vboxservice
      when: system_product.stdout == "VirtualBox"

    - name: "VMware configuration"
      lineinfile: >
        dest=/etc/rc.conf
        line="{{item}}_enable=\"YES\""
        regexp="^{{item}}_enable"
        insertafter=EOF
      with_items:
        - vmware_guest_vmblock
        - vmware_guest_vmhgfs
        - vmware_guest_vmmemctl
        - vmware_guest_vmxnet
        - vmware_guestd
      when: system_product.stdout == "VMware Virtual Platform"

# smbios.bios.vendor="BHYVE"

---
- hosts: all
  user: root
  gather_facts: no
  tasks:
    - name: "kenv smbios.system.product"
      shell: kenv smbios.system.product || true
      register: system_product

    - name: "kenv smbios.bios.vendor"
      shell: kenv smbios.bios.vendor || true
      register: bios_vendor

    - name: "VirtualBox configuration"
      lineinfile: >
        dest=/etc/rc.conf
        line="{{item}}_enable=\"YES\""
        regexp="^{{item}}_enable"
        insertafter=EOF
      with_items:
        - vboxguest
        - vboxservice
      when: system_product.stdout == "VirtualBox"

    - name: "VMware configuration"
      lineinfile: >
        dest=/etc/rc.conf
        line="{{item}}_enable=\"YES\""
        regexp="^{{item}}_enable"
        insertafter=EOF
      with_items:
        - vmware_guest_vmblock
        - vmware_guest_vmhgfs
        - vmware_guest_vmmemctl
        - vmware_guest_vmxnet
        - vmware_guestd
      when: system_product.stdout == "VMware Virtual Platform"

# smbios.bios.vendor="BHYVE"
# smbios.bios.vendor="Amazon EC2"

Add comment about EC2 vendor.
Add comment about EC2 vendor.
