Yes, you can do that.. in my case, I did a wrapper script that capture extra attributes in the script which later are used to build the packer json file
create_json_template () {
cat > $_JSONFILE << __EOF
{
"_comment": "This is a centos7-x64 Machine for VmWare ESXi 6.0",
"variables": {
"nameVm": "`echo $_HN`-centos-7.1-vmware",
"ks_file": "simple-ks-integrado-CIS-BitbyBit-packer.ks",
"ks_server": "192.168.1.150",
"ks_path": "centos7.1511_x64/ks/",
"vmware_host": "192.168.1.250",
"http_dir": "/packer",
"vmlinuz_file": "centos7.1503_x64/images/pxeboot/vmlinuz",
"initrd_file": "centos7.1503_x64/images/pxeboot/initrd.img",
"iso_md5":"111379a06402e1e445c6aeee9401d031",
"datastore":"datastore1",
"esx_host":"192.168.1.250",
"esx_user":"root",
"esx_user_key":"/var/tmp/id_rsa",
"os_type":"centos-64",
"esx_network":"VM Network",
"vms_dir_path":"`echo $_HN`",
"vmdk":"`echo $_HN`-root"
},