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": [
      "<esc><wait>",
      "vmlinuz initrd=initrd.img ipv6.disable=1 ",
      "inst.ks=http://xxx/pub/rhel8/ks/ks.cfg",
      "<enter>"
    ],
    "configuration_parameters": {
      "ethernet0.pciSlotNumber": "192"
    }
  }],