#!/bin/bash

BUILT_IN_CLOUDINIT=true

if $BUILT_IN_CLOUDINIT; then
    # Built-In Cloud-Init options
    CIUSER=default
    CIPASSWORD="password"
    # Static IP would be "gw=<GatewayIP>,ip=<IPv4Format/CIDR>"
    IPCONFIG="ip=dhcp"
    SSHKEYS=""

    QM_CLOUDINIT="--ciuser $CIUSER --cipassword $CIPASSWORD --ipconfig0 $IPCONFIG --sshkeys $SSHKEYS"
else
    # Custom Snippets
    SNIPPETS_LOCATION=local
    CIUSER_FILE=default-user.yml
    CINETWORK_FILE=default-network.yml
    CIMETA_FILE=default-meta.yml
    CIVENDOR_FILE=default-vendor.yml

    # Custom portions can be mixed and matched as needed. See below examples
    # QM_CLOUDINIT="--cicustom user=$SNIPPETS_LOCATION:snippets/$CIUSER_FILE"
    # QM_CLOUDINIT="--cicustom user=$SNIPPETS_LOCATION:snippets/$CIUSER_FILE,network=$SNIPPETS_LOCATION:snippets/$CINETWORK_FILE"
    # QM_CLOUDINIT="--cicustom vendor=$SNIPPETS_LOCATION:snippets/$CIVENDOR_FILE"
    QM_CLOUDINIT="--cicustom user=$SNIPPETS_LOCATION:snippets/$CIUSER_FILE,network=$SNIPPETS_LOCATION:snippets/$CINETWORK_FILE,meta=$SNIPPETS_LOCATION:snippets/$CIMETA_FILE,vendor=$SNIPPETS_LOCATION:snippets/$CIVENDOR_FILE"
fi

# VM Option Defaults
AGENT=1
BALLOON=0
MEMORY=1024
CORES=1
BIOS_TYPE=ovmf
CPU_TYPE="cputype=host"
EFI_OPTS="1,efitype=4m,pre-enrolled-keys=0"
MACHINE_TYPE=q35
OS_TYPE=l26
SCSI_TYPE=virtio-scsi-pci
CPU_SOCKETS=1
BRIDGE=vmbr0