I just got a solution to this tiny little problem (convert the vagrant.box file to .ova for use by the packer):
- Create vm using the .box file as the base. I use this
Vagrantfile , with the opscode-centos-7.0 field:
$ provisioning_script = << PROVISIONING_SCRIPT
adduser packer
echo "packer" | passwd packer --stdin
echo "packer ALL = (ALL: ALL) NOPASSWD: ALL"> /etc/sudoers.d/packer
PROVISIONING_SCRIPT
Vagrant.configure (2) do | config |
config.vm.box = "opscode-centos-7.0"
config.ssh.insert_key = false
config.vm.provider "virtualbox" do | v |
v.name = "packer-base"
end
config.vm.provision: shell, inline: $ provisioning_script
end
- run
vagrant up - run
vagrant halt - run
vboxmanage export --ovf20 -o packer-base.ova packer-base - run
vagrant destroy
This also creates the packer user with a default password, so that the packer can easily connect to the instance to do something. Also, pay attention to the insert_key parameter, which will prevent replacing the default swear key with a secure one and allow subsequent settings of the vagabonds to correctly connect via SSH to new images (after the package is completed).
source share