/** * Packer template for building MSVSphere 10 Vagrant boxes. */ source "virtualbox-iso" "msvsphere-10-vagrant-x86_64" { firmware = "efi" iso_url = var.iso_url_10_x86_64 iso_checksum = var.iso_checksum_10_x86_64 boot_command = var.vagrant_boot_cmd_10_x86_64_bios boot_wait = var.boot_wait cpus = var.cpus memory = var.memory disk_size = var.vagrant_disk_size headless = var.headless http_directory = var.http_directory guest_os_type = "RedHat_64" shutdown_command = var.vagrant_shutdown_command ssh_username = var.vagrant_ssh_username ssh_password = var.vagrant_ssh_password ssh_timeout = var.ssh_timeout hard_drive_interface = "sata" iso_interface = "sata" vboxmanage = [ ["modifyvm", "{{.Name}}", "--nat-localhostreachable1", "on"], ] vboxmanage_post = [ ["modifyvm", "{{.Name}}", "--memory", var.post_memory], ["modifyvm", "{{.Name}}", "--cpus", var.post_cpus] ] } source "vmware-iso" "msvsphere-10-vagrant-x86_64" { iso_url = var.iso_url_10_x86_64 iso_checksum = var.iso_checksum_10_x86_64 http_directory = var.http_directory shutdown_command = var.vagrant_shutdown_command ssh_username = var.vagrant_ssh_username ssh_password = var.vagrant_ssh_password ssh_timeout = var.ssh_timeout boot_command = var.vagrant_boot_cmd_10_x86_64_bios boot_wait = var.boot_wait disk_size = var.vagrant_disk_size guest_os_type = "centos-64" version = 21 vm_name = "MSVSphere-Vagrant-VMware-10-${formatdate("YYYYMMDD", timestamp())}.x86_64" cpus = var.cpus memory = var.memory network_adapter_type = "vmxnet3" headless = var.headless vmx_remove_ethernet_interfaces = true vmx_data = { "cpuid.coresPerSocket" : "1" } vmx_data_post = { "memsize" : var.post_memory "numvcpus" : var.post_cpus } } build { sources = [ "sources.virtualbox-iso.msvsphere-10-vagrant-x86_64", "sources.vmware-iso.msvsphere-10-vagrant-x86_64" ] provisioner "ansible" { playbook_file = "ansible/vagrant.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_SCP_EXTRA_ARGS=-O" ] extra_arguments = [ "--extra-vars", "packer_provider=${source.type}" ] } post-processors { post-processor "vagrant" { compression_level = "9" output = "MSVSphere-10-${formatdate("YYYYMMDD", timestamp())}.{{.Provider}}.x86_64.box" } } }