The below method you suggested works perfect for me :

"execute_command": "{{.Vars}} var1={{user `arg1`}} var2={{user `arg2`}} sudo 
-E -S bash '{{.Path}' "

But when the var1=test-packer-prov or var1=test.packer.prov then it fails 
with the "command not found" error.
 Where as if var1=test_packer_prov it works perfectly.

What I tried to add the escape \ with - the JSON parsing fails.

I am trying to use inline/file provision upload method(


On Tuesday, March 6, 2018 at 4:14:52 PM UTC+8, Alvaro Miranda Aguilera 
> hello
> if you can share what and how are you doing (and theres time explaining 
> why?) then will be easier to help you
> so far you are to the point you can have variables in packer and then use 
> them in the guest vm
> if you are having issues, perhaps you can use a file
> packer can provision a file and then on the script you can source the file 
> to have all the variables.
> special characters are hard since it may be interpreted somewhere.
> if I had to do this, probably will use shell local to put put the 
> variables in a file, or have them in a file already and then use them in 
> the VM.
> Alvaro

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/mitchellh/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 packer-tool+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
For more options, visit https://groups.google.com/d/optout.

Reply via email to