You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
cloud-images/msvsphere-9-ovf.pkr.hcl

60 lines
2.1 KiB

/**
* Packer template for building MSVSphere 9 ovf image.
*/
source "vmware-iso" "msvsphere-9-ovf-x86_64" {
vm_name = "MSVSphere-${var.os_version_9}-${formatdate("YYYYMMDD", timestamp())}.ovf.x86_64"
iso_url = var.iso_url_9_x86_64
iso_checksum = var.iso_checksum_9_x86_64
boot_command = var.ovf_boot_cmd_9_x86_64_bios
boot_wait = var.boot_wait
cpus = var.cpus
memory = var.memory
disk_size = var.vmware_disk_size
headless = var.headless
http_directory = var.http_directory
guest_os_type = "centos-64"
shutdown_command = var.root_shutdown_command
ssh_username = var.ovf_ssh_username
ssh_password = var.ovf_ssh_password
ssh_timeout = var.ssh_timeout
version = 15
vmx_data = {
"cpuid.coresPerSocket" : "1"
}
vmx_data_post = {
"memsize" : var.post_memory
"numvcpus" : var.post_cpus
}
vmx_remove_ethernet_interfaces = true
}
build {
sources = [
"sources.vmware-iso.msvsphere-9-ovf-x86_64"
]
provisioner "ansible" {
playbook_file = "ansible/ovf.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 = [
"--extra-vars",
"packer_provider=${source.type}"
]
}
post-processor "shell-local"{
inline = ["rm -rf vmware-iso.msvsphere-9-ovf-x86_64_ovf",
"mkdir vmware-iso.msvsphere-9-ovf-x86_64_ovf",
"/usr/lib/vmware-ovftool/ovftool --machineOutput --X:logFile=./ovftool.log --X:logLevel=verbose --exportFlags=extraconfig --allowExtraConfig --X:vCloudEnableGuestCustomization ./output-msvsphere-9-ovf-x86_64/MSVSphere-${var.os_version_9}-${formatdate("YYYYMMDD", timestamp())}.ovf.x86_64.vmx ./vmware-iso.msvsphere-9-ovf-x86_64_ovf"
]
}
}