RHEL 8 packer vsphere-iso

Hi All,

Does anyone have a working example of a RHEL8 packer setup for vsphere that they would be willing to share?

I have tried searching for examples but haven’t found a working one yet for RHEL 8.5 on vsphere using the vpshere-iso builder.

Thank you in advance for any assistance provided.

  "variables": {
    "adminuser": "{{env `ADMINUSER`}}",
    "adminpass": "{{env `ADMINPASS`}}",
    "vmpass": "{{env `VMPASS`}}",
    "vmuser": "{{env `VMUSER`}}",

    "fqdn": "{{env `FQDN`}}",

    "dsksz_os": "100000",
    "numcpu": "2",
    "nummem": "4096",
    "dtcntr": "xx-xx-xx",
    "dtstore": "Templates",
    "ntwrk": "xx",
    "clstr": "xxx",
    "vmfolder": "Templates/Packer",

    "packer_virt_sysprep_source_dir": "xx/packer-virt-sysprep/",
    "packer_virt_sysprep_dir": "/packer-virt-sysprep",
    "sysprep_op_bash_history": "true",
    "sysprep_op_crash_data": "true",
    "sysprep_op_dhcp_client_state": "false",
    "sysprep_op_firewall_rules": "true",
    "sysprep_op_logfiles": "true",
    "sysprep_op_machine_id": "true",
    "sysprep_op_mail_spool": "true",
    "sysprep_op_package_manager_cache": "true",
    "sysprep_op_rpm_db": "true",
    "sysprep_op_ssh_hostkeys": "true",
    "sysprep_op_tmp_files": "true",
    "sysprep_op_yum_uuid": "true",
    "sysprep_op_networkclean": "true",
    "sysprep_op_satelliteclean": "true"

  "sensitive-variables": ["vmpass", "vmuser", "adminpass"],

  "builders": [
    "type": "vsphere-iso",
    "vcenter_server": "vcenterxxx",
    "username": "{{user `vmuser`}}",
    "password": "{{user `vmpass`}}",
    "insecure_connection": "true",
    "vm_name": "{{user `fqdn`}}",
    "notes": "Built with linux-rhel84.json Project ID: xx xx/packer/linux-rhel8-packer",
    "datacenter": "{{user `dtcntr`}}",
    "cluster": "{{user `clstr`}}",
    "datastore": "{{user `dtstore`}}",
    "guest_os_type": "rhel8_64Guest",
    "folder": "{{user `vmfolder`}}",
    "ssh_username": "{{user `adminuser`}}",
    "ssh_password": "{{user `adminpass`}}",
    "CPUs": "{{user `numcpu`}}",
    "CPU_hot_plug": true,
    "RAM": "{{user `nummem`}}",
    "RAM_reserve_all": false,
    "RAM_hot_plug": true,
    "disable_shutdown": true,
    "convert_to_template": true,
    "network_adapters": [
      "network": "{{user `ntwrk`}}",
      "network_card": "vmxnet3"
    "disk_controller_type": [ "pvscsi"],
    "storage": [
        "disk_size": "{{user `dsksz_os`}}",
        "disk_controller_index": 0
    "iso_paths": [
      "[Templates] ISO/rhel-8.4-x86_64-dvd.iso"
    "iso_checksum": "sha256:xxxx",
    "boot_wait": "30s",
    "boot_command": [
      "vmlinuz initrd=initrd.img ipv6.disable=1 ",
    "configuration_parameters": {
      "ethernet0.pciSlotNumber": "192"

Thank you @michael.jones really appreciate you sending this through. I hope you dont mind me asking but just wanted to clarify the sysprep variables.

is that something that needs to be downloaded separately? as the only example of it i can find is here GitHub - DanHam/packer-virt-sysprep: Reproduce the functionality of virt-sysprep for use with Packer builds

Hope its not asking to much but do you mind sharing your ks.cfg? i’d be keen to see how this all fits together.

Thank you again for sending through the script.