packaged box not using winrm

37 views
Skip to first unread message

Layla Sian

unread,
Nov 11, 2015, 12:03:00 PM11/11/15
to Vagrant
hi there,

I've packaged a virtualbox (4.3.28) vm made with vagrant (1.7.4) to share with a team member. I used the command vagrant package --base uuid, where uuid = the VirtualBox uuid.


The source box is using the winrm communicator successfully, when I vagrant up I see the feedback of the WinRM address, username and transport method. But when my team member adds the package box and tries to bring it up, she gets a whole slew of 'connection timeout: retrying' messages and I've determined that it is because it is using SSH.

can anyone advise me on why the packaged box isn't configured the same way as the source box?


thanks,
Layla

Alvaro Miranda Aguilera

unread,
Nov 12, 2015, 8:17:53 AM11/12/15
to vagra...@googlegroups.com
Hello,

Please check your co-worker have an up-to-date vagrant version, and
also share your Vagrantfile with him.

on the Vagrantfile, you can use

config.vm.box = "name"
config.vm.box_url = "name.box"

or

if you have access to a http server

config.vm.box_url = "http://someinternalserver/path/name,box"

In that way you can share the Vagrantfile only.

If that work, will confirm the VM is good, you can create an
organization in atlas, and create a private box. Then you can define
an external url, so your co-workers can do

vagrant init -m "org/name"
vagrant up

And they will download from the internal server.

Hope this helps.

Alvaro.
> --
> 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+...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/vagrant-up/ad4acb06-818f-4053-bfd0-1898342621dd%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Layla Sian

unread,
Nov 12, 2015, 1:24:45 PM11/12/15
to Vagrant
thanks for your reply. I was able to manually solve the issue by fixing their vagrantfile.

However I would like to know how to have a better process. I can't just share my Vagrantfile which is associated with the packaged VM. My Vagrantfile does not have a config line for the communicator. I presume this is because that information is associated with the actual box that my vagrant VM was made from. So to be clear, this was the current process that doesn't work as I expect.

1. using packer I build a base Windows 2012 server and it is using winrm & virtualbox.
2. I do "vagrant add box -name base2012 PATHTOBOX"
3. I make myself a project dir then I do "vagrant init base2012". Note that this Vagrantfile created does not have config for winrm in the file. I presume that is because it is associated with the base2012box, not this particular VM instance of it.
4. I use this VM, customize the Vagrantfile, and set up a website. I then package this VM into package.box per Vagrant documentation.
5. Another member adds package.box.

Following these steps, the instance brought up from package.box tries to use SSH. And, even though the VM that was my source in step 4 has port forwarding from 80 to 8080, this is also not copied. Is this working as designed? I am expected to manually copy any necessary config from both the original box Vagrantfile (from step 1) and the project VM (from step 4) to make a Vagrantfile just to go along with package.box?

I just want to be sure I am understanding correctly and not missing ant steps that would bring in more automation.

thanks,
Layla

Alvaro Miranda Aguilera

unread,
Nov 14, 2015, 9:51:32 PM11/14/15
to vagra...@googlegroups.com
Hello,

Have a look at this:

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

--include x,y,z - Additional files will be packaged with the box.
These can be used by a packaged Vagrantfile (documented below) to
perform additional tasks.

--vagrantfile FILE - Packages a Vagrantfile with the box, that is
loaded as part of theVagrantfile load order when the resulting box is
used.

A common misconception is that the --vagrantfile option will package a
Vagrantfile that is used when vagrant init is used with this box. This
is not the case. Instead, a Vagrantfile is loaded and read as part of
the Vagrant load process when the box is used. For more information,
read about the Vagrantfile load order.



So, you should be able to include a base Vagrantfile that set winrm

try including a Vagrantfile that does

puts "from the Vagranfile included with the base box"

so something

Then package the box, include that file, add the box with a new name
and test if works for you

you can check the boxes at your home directory and then go to .vagrant.d/boxes/

Hope this helps

Alvaro.
> https://groups.google.com/d/msgid/vagrant-up/9d5d723b-865d-44ea-8e34-707ddd49e394%40googlegroups.com.

Layla Sian

unread,
Nov 20, 2015, 2:13:16 PM11/20/15
to Vagrant
thanks so much, I misunderstood that note on the docs about Vagrantfile before. I used the --vagrantfile option to point to my box's config and got the desired result.


On Saturday, November 14, 2015 at 9:51:32 PM UTC-5, Alvaro Miranda Aguilera wrote:
Hello,

Reply all
Reply to author
Forward
0 new messages