/** * Packer template for building MSVSphere 9 Generic Cloud images. */ source "qemu" "msvsphere-9-gencloud-x86_64" { iso_url = var.iso_url_9_x86_64 iso_checksum = var.iso_checksum_9_x86_64 boot_command = var.gencloud_boot_cmd_9_x86_64_uefi boot_wait = var.boot_wait cpus = var.cpus memory = var.memory disk_size = var.gencloud_disk_size headless = var.headless http_directory = var.http_directory shutdown_command = var.root_shutdown_command ssh_username = var.gencloud_ssh_username ssh_password = var.gencloud_ssh_password ssh_timeout = var.ssh_timeout vnc_bind_address = var.vnc_bind_address vnc_port_min = var.vnc_port_min vnc_port_max = var.vnc_port_max accelerator = "kvm" efi_firmware_code = var.uefi_ovmf_code efi_firmware_vars = var.uefi_ovmf_vars disk_interface = "virtio-scsi" disk_cache = "unsafe" disk_discard = "unmap" disk_detect_zeroes = "unmap" disk_compression = true format = "qcow2" machine_type = "q35" net_device = "virtio-net" qemu_binary = var.qemu_binary vm_name = "MSVSphere-${var.os_version_9}-${formatdate("YYYYMMDD", timestamp())}.gencloud.x86_64.qcow2" qemuargs = [ ["-cpu", "host"] ] } build { sources = [ "qemu.msvsphere-9-gencloud-x86_64" ] provisioner "ansible" { playbook_file = "ansible/gencloud.yml" galaxy_file = "ansible/requirements.yml" roles_path = "ansible/roles" collections_path = "ansible/collections" ansible_env_vars = [ "ANSIBLE_PIPELINING=True", "ANSIBLE_REMOTE_TEMP=/tmp", "ANSIBLE_SSH_ARGS='-o ControlMaster=no -o ControlPersist=180s -o ServerAliveInterval=120s -o TCPKeepAlive=yes -o HostKeyAlgorithms=+ssh-rsa -o PubkeyAcceptedKeyTypes=+ssh-rsa'" ] extra_arguments = ["--scp-extra-args", "'-O'"] } }