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 

something like

*script.sh -c root_pwd *

then you can create within the script the Packer Json file dynamically

something similar to this

*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_image":"http://192.168.1.150/isos/CentOS-7-x86_64-NetInstall-1503.iso";,
    "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"

  },

https://github.com/macgahe/packer/blob/master/Centos7_packer_template.json
On Wednesday, January 20, 2021 at 11:07:25 AM UTC+1 [email protected] 
wrote:

> Team,
>
> Is there a way to pass variable values from packer to kickstart file?  We 
> would like to pass the secrets (like root passwords) from packer to 
> kickstart. Is there a way to do the same?
>
> ---
> Best regards,
> Gowtham
> 07798838879 
>
>
> =====================
> Learn from mistakes....
>
> Please consider the environment before printing this email - Thanks
>

-- 
This mailing list is governed under the HashiCorp Community Guidelines - 
https://www.hashicorp.com/community-guidelines.html. Behavior in violation of 
those guidelines may result in your removal from this mailing list.

GitHub Issues: https://github.com/hashicorp/packer/issues
IRC: #packer-tool on Freenode
--- 
You received this message because you are subscribed to the Google Groups 
"Packer" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/packer-tool/106897f0-16d5-488b-8e68-3c0b19545ff6n%40googlegroups.com.

Reply via email to