thanks for your reply. 
this json can be working successfully,

      "vboxmanage"           : [
        [ "modifyvm", "{{.Name}}", "--memory", "{{user `memSize`}}"],
        [ "modifyvm", "{{.Name}}", "--cpus",   "{{user `cpuCount`}}" ],
        [ "modifyvm", "{{.Name}}", "--nic1", "nat"]
      ],

if i add  vboxmanage_post 
<https://www.packer.io/docs/builders/virtualbox-iso.html#vboxmanage_post>  like 
this,
     "vboxmanage_post": ["modifyvm", "{{.Name}}", "--nic1", "bridged"],
     
but when running the json, vboxmanage run failed, can you help to tell me 
what's the problem with my json file ?
my packer version is 1.1.3. 

from my point, after vm was poweroff, can {{.Name}} point to the new 
created vm ? 


the full json file is: 
{
  "description"              : "import a existing ova and pull image and 
then export to as a ova image",

  "variables"                : {
    "diskImg"                : "/vmimage/OMSP.ova",
    "vmName"                 : "OracleLinux7u4_vbox",
    "memSize"                : "2048",
    "cpuCount"               : "1",
    "diskSize"               : "36720",
    "diskFmt"                : "ova",
    "chefCookbooks"          : "cookbooks",
    "nicInterFace"           : "eno1",
    "chefRunlist"            : "recipe[httpd]"
  },

  "builders"                 : [{
      "type"                 : "virtualbox-ovf",
      "name"                 : "vboxOvfBuilder",
      "vboxmanage"           : [
        [ "modifyvm", "{{.Name}}", "--memory", "{{user `memSize`}}"],
        [ "modifyvm", "{{.Name}}", "--cpus",   "{{user `cpuCount`}}" ],
        [ "modifyvm", "{{.Name}}", "--nic1", "nat"]
      ],
     "vboxmanage_post": ["modifyvm", "{{.Name}}", "--nic1", "bridged"],
      "export_opts":
      [
      "--manifest",
      "--vsys", "0",
      "--description", "create vm with nat and then change to bridged",
      "--version", "2.0"
      ],
      "source_path"          : "{{user `diskImg`}}",
      "format"               : "{{user `diskFmt`}}",
      "headless"             : true,
      "vrdp_bind_address"    : "0.0.0.0",
      "ssh_host_port_min"    : 2222,
      "ssh_host_port_max"    : 2229,
      "output_directory"     : "images-{{timestamp}}",
      "communicator"         : "ssh",
      "ssh_port"             : 22,
      "ssh_username"         : "root",
      "ssh_password"         : "welcome1",
      "ssh_wait_timeout"     : "1500s",
      "vm_name"              : 
"oraclelinux7u4-vbox_bridge_1nat-{{timestamp}}",
      "shutdown_command"     : "shutdown -P now"
    }
  ],
  "provisioners": [{
      "type"                 : "shell",
      "script"               : "scripts/getimage.sh"
    }
  ]
}






On Wednesday, January 24, 2018 at 10:03:36 PM UTC+8, Rickard von Essen 
wrote:
>
> See 
> https://www.packer.io/docs/builders/virtualbox-iso.html#vboxmanage_post
>
> On Jan 24, 2018 14:11, "JerryWang" <[email protected] <javascript:>> 
> wrote:
>
>>  this steps should be done after provioner  ( and vm was poweroff ), 
>> where to put this operation ?  builder ? or  post-processor ?
>> 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/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 [email protected] <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/packer-tool/fc2eb65c-4b39-4034-a48d-1abc99be9950%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/packer-tool/fc2eb65c-4b39-4034-a48d-1abc99be9950%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/packer-tool/591c3fd9-c030-41bd-84e2-8d67e9c18dbf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to