Hello

you have 3 vbox manage options.

for the vm when created used for packer
for vm changes before export


There is an export/import that Packer does that reset many values to default

So, you can add a copy or move those nic changes to :
vboxmanage_post
<https://www.packer.io/docs/builders/virtualbox-iso.html#vboxmanage_post>
(array
of array of strings) - Identical to vboxmanage, except that it is run after
the virtual machine is shutdown, and before the virtual machine is exported.

On Wed, Sep 14, 2016 at 2:22 AM, Ameya Karkhanis <[email protected]
> wrote:

> Hi
> I am using packer to build a Virtual box image running 64bit ubuntu
> 14.04.4 server. My use case is when users import this image by default
> their networking is set to Bridged mode and the option to reinitialize mac
> address be set.
> I tried to enforce that in my template.json as *below*:
>
> Is there a way to enforce this when the off file is built?
> Is this virtual box specific issue? Should I try this with VMware?
>
> Any help is much appreciated.
>
> {
>   "builders": [
>     {
>       "type": "virtualbox-iso",
>       "boot_command": [
>         "<esc><wait>",
>         "<esc><wait>",
>         "<enter><wait>",
>         "/install/vmlinuz<wait>",
>         " auto<wait>",
>         " console-setup/ask_detect=false<wait>",
>         " console-setup/layoutcode=us<wait>",
>         " console-setup/modelcode=pc105<wait>",
>         " debian-installer=en_US<wait>",
>         " fb=false<wait>",
>         " initrd=/install/initrd.gz<wait>",
>         " kbd-chooser/method=us<wait>",
>         " keyboard-configuration/layout=USA<wait>",
>         " keyboard-configuration/variant=USA<wait>",
>         " locale=en_US<wait>",
>         " netcfg/get_hostname=ubuntu-1404<wait>",
>         " netcfg/get_domain=vm<wait>",
>         " noapic<wait>",
>         " preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort
> }}/preseed.cfg<wait>",
>         " -- <wait>",
>         "<enter><wait>"
>       ],
>       "boot_wait": "10s",
>       "disk_size": 40960,
>       "guest_os_type": "Ubuntu_64",
>       "http_directory": "http",
>       "iso_checksum": "2ac1f3e0de626e54d05065d6f549fa3a",
>       "iso_checksum_type": "md5",
>       "iso_url": "http://releases.ubuntu.com/14.04/ubuntu-14.04.4-server-
> amd64.iso",
>       "ssh_username": "***",
>       "ssh_password": "***",
>       "ssh_port": 22,
>       "ssh_wait_timeout": "10000s",
>       "shutdown_command": "echo 'shutdown -P now' > /tmp/shutdown.sh; echo
> '***'|sudo -S sh '/tmp/shutdown.sh'",
>       "vboxmanage": [
>         [
>           "modifyvm",
>           "{{.Name}}",
>           "--memory",
>           "1024"
>         ],
>         [
>           "modifyvm",
>           "{{.Name}}",
>           "--cpus",
>           "1"
>       ],
>       [
>           "modifyvm",
>           "{{.Name}}",
>           "--usb",
>           "on"
>       ],
>      * [*
> *          "modifyvm",*
> *          "{{.Name}}",*
> *          "--nic0",*
> *          "bridged"*
> *      ],*
> *      [*
> *          "modifyvm",*
> *          "{{.Name}}",*
> *          "--macaddress0",*
> *          "auto"*
> *      ]*
>       ]
>     }
> ],
> "provisioners": [
>     {
>      "type": "shell",
>      "execute_command": "echo '***'|sudo -E -S sh '{{.Path}}'",
>      "override": {
>        "virtualbox-iso": {
>          "scripts": [
>             "scripts/base.sh",
>             "scripts/virtualbox.sh",
>             "scripts/some_custom_scripts.sh",
>             "scripts/cleanup.sh",
>             "scripts/zerodisk.sh"
>          ]
>        }
>      }
>    }
>  ]
> }
>
> --
> 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/e8bf8e0f-a520-4d4d-8d53-e657ac2ba6de%40googlegroups.com
> <https://groups.google.com/d/msgid/packer-tool/e8bf8e0f-a520-4d4d-8d53-e657ac2ba6de%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Alvaro
(+31)103400555

-- 
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/CAHqq0eyRUZECygMSDgrKjD9V9Re6vyp%3D3nL0N2nWa6VLtGBLyw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to