vagrantfile in boxes

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

vagrantfile in boxes

andrewsav
This page on vagrant file format tells us:

Today, there are three different components:

  • Box File - This is a compressed (tartar.gzzip) file that is specific to a single provider and can contain anything. Vagrant core does not ever use the contents of this file. Instead, they are passed to the provider. Therefore, a VirtualBox box file has different contents from a VMware box file and so on.

  • Box Catalog Metadata - This is a JSON document (typically exchanged during interactions with HashiCorp's Vagrant Cloud) that specifies the name of the box, a description, available versions, available providers, and URLs to the actual box files (next component) for each provider and version. If this catalog metadata does not exist, a box file can still be added directly, but it will not support versioning and updating.

  • Box Information - This is a JSON document that can provide additional information about the box that displays when a user runs vagrant box list -i. More information is provided here.

Note, how vargrantfile is not mentioned anywhere in this description or elsewhere on the page.

Yet, if we read this page from packer documentation we can read:

vagrantfile_template (string) - Path to a template to use for the Vagrantfile that is packaged with the box. 

This implies that a vagrantfile can indeed be packaged with the box.

How does this work? Why one includes vagrantfile with a box and how this vagrantfile is used and how it interact with the normal vagrantfile which we are using with `vagrant up`?

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/0248837a-7d7d-484d-8786-e8664b3e8eff%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: vagrantfile in boxes

Alvaro Miranda Aguilera
Hello

lets say your user is home is /home/user

and you have a project like this

/home/user/myproject

Vagrant home directory will be

/home/user/.vagrant.d

The box or your setup can include multiples Vagrantfiles that are all read and joined in memory

/home/user/myproject/Vagrantfile  # this is your local project Vagrantfile, things here are used only is this local project

/home/user/.vagrant.d/boxes/<box>/<version/provider>/Vagrantfile  # this is your box Vagrantfile , will be used in all the projects that use this box.

/home/user/.vagrant.d/Vagrantfile  # this is your global Vagrantfile , will be used in all the projects




Seems you are right that the box one is not in the documentation.
Will check and came back with something.



When a box includes a Vagrantfile, its to set something at box level, say you don't want to use Virtualbox shared folder and want to use/force rsync.


Thats the one that packer can include.

ie:

$ find ~/.vagrant.d/boxes/ -name Vagrantfile
/c/Users/kikitux/.vagrant.d/boxes/bento-VAGRANTSLASH-ubuntu-16.04/201708.22.0/virtualbox/Vagrantfile
/c/Users/kikitux/.vagrant.d/boxes/centos-VAGRANTSLASH-7/1611.01/virtualbox/Vagrantfile
/c/Users/kikitux/.vagrant.d/boxes/ferventcoder-VAGRANTSLASH-win2012r2-x64-nocm/1.0.0/virtualbox/Vagrantfile
/c/Users/kikitux/.vagrant.d/boxes/hashicorp-VAGRANTSLASH-precise64/1.1.0/virtualbox/Vagrantfile
/c/Users/kikitux/.vagrant.d/boxes/iseo_tech-VAGRANTSLASH-CentOS-7-x86_64-DVD-1503-01/7.1.1/virtualbox/Vagrantfile
/c/Users/kikitux/.vagrant.d/boxes/oraclelinux7/0/virtualbox/Vagrantfile
/c/Users/kikitux/.vagrant.d/boxes/ubuntu-VAGRANTSLASH-trusty64/20171026.0.0/virtualbox/Vagrantfile



example of utilization:

$ cat /c/Users/kikitux/.vagrant.d/boxes/centos-VAGRANTSLASH-7/1611.01/virtualbox/Vagrantfile
Vagrant.configure("2") do |config|
  config.vm.base_mac = "525400225b53"
  config.vm.synced_folder ".", "/vagrant", type: "rsync"
end






Alvaro.

On Thu, Nov 16, 2017 at 6:26 AM, <[hidden email]> wrote:
This page on vagrant file format tells us:

Today, there are three different components:

  • Box File - This is a compressed (tartar.gzzip) file that is specific to a single provider and can contain anything. Vagrant core does not ever use the contents of this file. Instead, they are passed to the provider. Therefore, a VirtualBox box file has different contents from a VMware box file and so on.

  • Box Catalog Metadata - This is a JSON document (typically exchanged during interactions with HashiCorp's Vagrant Cloud) that specifies the name of the box, a description, available versions, available providers, and URLs to the actual box files (next component) for each provider and version. If this catalog metadata does not exist, a box file can still be added directly, but it will not support versioning and updating.

  • Box Information - This is a JSON document that can provide additional information about the box that displays when a user runs vagrant box list -i. More information is provided here.

Note, how vargrantfile is not mentioned anywhere in this description or elsewhere on the page.

Yet, if we read this page from packer documentation we can read:

vagrantfile_template (string) - Path to a template to use for the Vagrantfile that is packaged with the box. 

This implies that a vagrantfile can indeed be packaged with the box.

How does this work? Why one includes vagrantfile with a box and how this vagrantfile is used and how it interact with the normal vagrantfile which we are using with `vagrant up`?

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/0248837a-7d7d-484d-8786-e8664b3e8eff%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/CAHqq0ezKu6_ezUWyYe36570%3DV7FA5ozCXd2nsHAPQugs_YEOgw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: vagrantfile in boxes

andrewsav
Thank you, that makes sense!

On Friday, 17 November 2017 00:14:03 UTC+13, Alvaro Miranda Aguilera wrote:
Hello

lets say your user is home is /home/user

and you have a project like this

/home/user/myproject

Vagrant home directory will be

/home/user/.vagrant.d

The box or your setup can include multiples Vagrantfiles that are all read and joined in memory

/home/user/myproject/Vagrantfile  # this is your local project Vagrantfile, things here are used only is this local project

/home/user/.vagrant.d/boxes/<box>/<version/provider>/Vagrantfile  # this is your box Vagrantfile , will be used in all the projects that use this box.

/home/user/.vagrant.d/Vagrantfile  # this is your global Vagrantfile , will be used in all the projects


<a href="https://www.vagrantup.com/docs/vagrantfile/#lookup-path" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fwww.vagrantup.com%2Fdocs%2Fvagrantfile%2F%23lookup-path\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEMjVKj9ZH9QJURgln_haX3Zn_2Gw&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fwww.vagrantup.com%2Fdocs%2Fvagrantfile%2F%23lookup-path\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEMjVKj9ZH9QJURgln_haX3Zn_2Gw&#39;;return true;">https://www.vagrantup.com/docs/vagrantfile/#lookup-path


Seems you are right that the box one is not in the documentation.
Will check and came back with something.



When a box includes a Vagrantfile, its to set something at box level, say you don't want to use Virtualbox shared folder and want to use/force rsync.


Thats the one that packer can include.

ie:

$ find ~/.vagrant.d/boxes/ -name Vagrantfile
/c/Users/kikitux/.vagrant.d/boxes/bento-VAGRANTSLASH-ubuntu-16.04/201708.22.0/virtualbox/Vagrantfile
/c/Users/kikitux/.vagrant.d/boxes/centos-VAGRANTSLASH-7/1611.01/virtualbox/Vagrantfile
/c/Users/kikitux/.vagrant.d/boxes/ferventcoder-VAGRANTSLASH-win2012r2-x64-nocm/1.0.0/virtualbox/Vagrantfile
/c/Users/kikitux/.vagrant.d/boxes/hashicorp-VAGRANTSLASH-precise64/1.1.0/virtualbox/Vagrantfile
/c/Users/kikitux/.vagrant.d/boxes/iseo_tech-VAGRANTSLASH-CentOS-7-x86_64-DVD-1503-01/7.1.1/virtualbox/Vagrantfile
/c/Users/kikitux/.vagrant.d/boxes/oraclelinux7/0/virtualbox/Vagrantfile
/c/Users/kikitux/.vagrant.d/boxes/ubuntu-VAGRANTSLASH-trusty64/20171026.0.0/virtualbox/Vagrantfile



example of utilization:

$ cat /c/Users/kikitux/.vagrant.d/boxes/centos-VAGRANTSLASH-7/1611.01/virtualbox/Vagrantfile
Vagrant.configure("2") do |config|
  config.vm.base_mac = "525400225b53"
  config.vm.synced_folder ".", "/vagrant", type: "rsync"
end






Alvaro.

On Thu, Nov 16, 2017 at 6:26 AM, <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="Aj3rsZRnCAAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">andr...@...> wrote:
<a href="https://www.vagrantup.com/docs/boxes/format.html" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fwww.vagrantup.com%2Fdocs%2Fboxes%2Fformat.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGCeblk1Pz6_JgUJ9a8B6ZApmHpZA&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fwww.vagrantup.com%2Fdocs%2Fboxes%2Fformat.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGCeblk1Pz6_JgUJ9a8B6ZApmHpZA&#39;;return true;">This page on vagrant file format tells us:

Today, there are three different components:

  • Box File - This is a compressed (tartar.gzzip) file that is specific to a single provider and can contain anything. Vagrant core does not ever use the contents of this file. Instead, they are passed to the provider. Therefore, a VirtualBox box file has different contents from a VMware box file and so on.

  • Box Catalog Metadata - This is a JSON document (typically exchanged during interactions with <a href="https://www.vagrantup.com/docs/vagrant-cloud" style="background-color:transparent;color:rgb(21,99,255)" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fwww.vagrantup.com%2Fdocs%2Fvagrant-cloud\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGgsA9ZA50n942is4Yc_a2-eKJJ9A&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fwww.vagrantup.com%2Fdocs%2Fvagrant-cloud\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGgsA9ZA50n942is4Yc_a2-eKJJ9A&#39;;return true;">HashiCorp's Vagrant Cloud) that specifies the name of the box, a description, available versions, available providers, and URLs to the actual box files (next component) for each provider and version. If this catalog metadata does not exist, a box file can still be added directly, but it will not support versioning and updating.

  • Box Information - This is a JSON document that can provide additional information about the box that displays when a user runs vagrant box list -i. More information is provided <a href="https://www.vagrantup.com/docs/boxes/info.html" style="background-color:transparent;color:rgb(21,99,255)" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fwww.vagrantup.com%2Fdocs%2Fboxes%2Finfo.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHRY5QQ6obNeowPyS-CHGAVmnTGlQ&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fwww.vagrantup.com%2Fdocs%2Fboxes%2Finfo.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHRY5QQ6obNeowPyS-CHGAVmnTGlQ&#39;;return true;">here.

Note, how vargrantfile is not mentioned anywhere in this description or elsewhere on the page.

Yet, if we read <a href="https://www.packer.io/docs/post-processors/vagrant.html" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fwww.packer.io%2Fdocs%2Fpost-processors%2Fvagrant.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNE7wmhHPBHVjLMnkOJo1oT8J3k5ug&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fwww.packer.io%2Fdocs%2Fpost-processors%2Fvagrant.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNE7wmhHPBHVjLMnkOJo1oT8J3k5ug&#39;;return true;">this page from packer documentation we can read:

<a href="https://www.packer.io/docs/post-processors/vagrant.html#vagrantfile_template" style="color:rgb(29,174,255);font-family:&quot;Open Sans&quot;,sans-serif;font-size:15px" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fwww.packer.io%2Fdocs%2Fpost-processors%2Fvagrant.html%23vagrantfile_template\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHhOORC661XBrHKe7Q_1ngWDJwMmQ&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fwww.packer.io%2Fdocs%2Fpost-processors%2Fvagrant.html%23vagrantfile_template\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHhOORC661XBrHKe7Q_1ngWDJwMmQ&#39;;return true;">vagrantfile_template (string) - Path to a template to use for the Vagrantfile that is packaged with the box. 

This implies that a vagrantfile can indeed be packaged with the box.

How does this work? Why one includes vagrantfile with a box and how this vagrantfile is used and how it interact with the normal vagrantfile which we are using with `vagrant up`?

--
This mailing list is governed under the HashiCorp Community Guidelines - <a href="https://www.hashicorp.com/community-guidelines.html" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fwww.hashicorp.com%2Fcommunity-guidelines.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGHa_CaKfZaJiwbkUndUQbVGlQCDw&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fwww.hashicorp.com%2Fcommunity-guidelines.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGHa_CaKfZaJiwbkUndUQbVGlQCDw&#39;;return true;">https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: <a href="https://github.com/mitchellh/vagrant/issues" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fmitchellh%2Fvagrant%2Fissues\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHxcA5DuHlQlPInMi_k1Pz4pMNqNw&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fmitchellh%2Fvagrant%2Fissues\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHxcA5DuHlQlPInMi_k1Pz4pMNqNw&#39;;return true;">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 <a href="javascript:" target="_blank" gdf-obfuscated-mailto="Aj3rsZRnCAAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">vagrant-up+...@googlegroups.com.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/vagrant-up/0248837a-7d7d-484d-8786-e8664b3e8eff%40googlegroups.com?utm_medium=email&amp;utm_source=footer" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/vagrant-up/0248837a-7d7d-484d-8786-e8664b3e8eff%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/vagrant-up/0248837a-7d7d-484d-8786-e8664b3e8eff%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/d/msgid/vagrant-up/0248837a-7d7d-484d-8786-e8664b3e8eff%40googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.



--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/292df577-b03c-4a8d-89e6-907295f48727%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.