Hello,

There's obviously something I'm missing in my understanding of the workflow 
from packer to vagrant.

Let's say I'm having to do multiple packer runs for some reason, say, 
having to debug or fine tune the ks.cfg for centos7.2 installs.  If it 
matters I'm using virtualbox-iso.

My understanding of the workflow is:

packer validate
packer build
vagrant init
vagrant up
vagrant ssh
examine results
vagrant destroy
correct/modify/enhance ks.cfg
repeat

BUT:

I'm finding that I have to do:

vagrant box delete <boxpath/boxname>

before the packer build.  Is this correct?  If so, isn't there an overwrite 
option?

And then, the packer init won't build unless I delete Vagrantfile.  Then it 
generates a bare-bones vagrantfile, not the one in the .box.  I end up 
having to copy my vagranfile template to Vagrantfile manually.  This can't 
be right.So what am I missing here?




The working directory is
   
 ~/centos-minimal

I've got a Vagrantfile template ~/Vagrantfile-centos-7.2-minimal 


$ cat Vagrantfile-centos-7.2-minimal 

Vagrant.configure(2) do |config|
  config.vm.box = "builds/centos-7.2.virtualbox.box"
  config.ssh.insert_key = false
  config.vm.synced_folder ".", "/pub", :mount_options => ["dmode=777", 
"fmode=666"]
end


Here's the post-processor "vagrant" section of the .json

  "post-processors": [
    {
      "type": "vagrant",
      "output": "builds/{{user `box_basename`}}.{{.Provider}}.box",
      "vagrantfile_template":"Vagrantfile-centos-7.2-minimal",
      "keep_input_artifact": true
    }

the packer build seems to run to completion just fine.  And it does create 
a builds/centos-7.2.virtualbox.box


So, packer build finishes.   My understanding is I then have to:

vagrant init builds/centos-7.2.virtualbox.box
vagrant up





If I tar xvzf centos-7.2.virtualbox.box, the expected Vagrantfile is shown 
to be part of the .box


$ tar xvzf centos-7.2.virtualbox.box 
Vagrantfile
box.ovf
centos-7.2-x86_64-disk1.vmdk
metadata.json


[builds]$ cat Vagrantfile 

# The contents below were provided by the Packer Vagrant post-processor

Vagrant.configure("2") do |config|
  config.vm.base_mac = "0800270B9CB5"
end


# The contents below (if any) are custom contents provided by the
# Packer template during image build.
Vagrant.configure(2) do |config|
  config.vm.box = "builds/centos-7.2.virtualbox.box"
  config.ssh.insert_key = false
  config.vm.synced_folder ".", "/pub", :mount_options => ["dmode=777", 
"fmode=666"]
end

 Side question:  are there really supposed to be two

      Vagrant.Configure("2") do |config| 

Sections?  Is that legal?

I hope this is clear...if not, just ask.  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/vagrant/issues
IRC: #vagrant on Freenode
--- 
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 vagrant-up+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vagrant-up/d9827bcc-86d7-46c9-8322-faf5f2c24381%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to