Hello,

2 options.

A.

you create a box using the source machine

you provision with the Vagrantfile, then you need to use vagrant package

https://docs.vagrantup.com/v2/cli/package.html

It need to match the name of the vm in the gui, so you can use

VBoxManage list vms

and then

vagrant package --base <source_vm_name> --output <name_of_box.box>

just use a final name on the output, since I read that some people had
issues if they rename it.


B.

You copy the ovf and vmdk of the source to a directory, and use packer.io

you can put those files into a directory, say source, then create a
packer json template like this

{
    "variables": {
    "ssh_name": "vagrant",
    "ssh_pass": "vagrant",
    "output": "outputbox",
    "compression" : 6
    },

    "builders": [{
        "type": "virtualbox-ovf",
        "guest_additions_mode": "disable",
        "source_path": "source/packer-virtualbox-ovf-1423592072.ovf",
        "output_directory": "output-{{user `output`}}",
        "vm_name": "{{user `hostname`}}",
    "headless" : 0,
        "ssh_username": "{{user `ssh_name`}}",
        "ssh_password": "{{user `ssh_pass`}}",
        "ssh_wait_timeout": "40m",
        "shutdown_command": "shutdown -h now",
        "shutdown_timeout": "40m"
    }],

  "provisioners"             : [
    {
    "type": "shell",
    "execute_command": "sh '{{ .Path }}'",
    "inline": [
      "echo line end in comma",
      "echo last line has no comma"
       ]
  }
],

  "post-processors": [
    {
      "type": "vagrant",
      "only": ["virtualbox-ovf"],
      "keep_input_artifact": true,
      "output": "{{user `output`}}.box",
      "compression_level": "{{user `compression`}}"
    }
  ]
}

On Wed, Feb 11, 2015 at 8:01 AM, Douglas Garstang
<[email protected]> wrote:
> All,
>
> I'm trying to rebundle the Ubuntu vagrant box (add some stuff to it). So, I
> started with the virtualbox-ovf builder. I have a resulting
> output-virtualbox-ovf/ directory with the following files in it.
>
> [chef=dev] Douglass-MacBook-Pro:output-virtualbox-ovf doug$ ls -l
> total 819680
> -rw-------  1 doug  staff  419660288 Feb 10 10:15
> packer-virtualbox-ovf-1423592072-disk1.vmdk
> -rw-------  1 doug  staff      11426 Feb 10 10:15
> packer-virtualbox-ovf-1423592072.ovf
>
> I've been searching for hours and I can't find how to add this back into
> vagrant again as a box so I can use it. I'm rather frustrated that this
> seems so difficult. I've tried using various combinations of 'vagrant box
> add' and all return errors. I then moved onto 'VBoxManage import', which
> does something, I just don't know what.
>
> I suppose I could use the source Ubuntu vagrant box, use a Vagrantfile to
> start the VM, and then a shell provisioner in Vagrantfile to add what I
> need, and then use 'vagrant package' but that seems clunky compared to just
> using the virtualbox builder and doing it in one step with that.
>
> Doug
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Vagrant" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to