Multi-machine Vagrant file to use one VM?

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

Multi-machine Vagrant file to use one VM?

Gregory Schultz
Hello,

I design websites and would like to start using multi-machine setup. Is it possible to use one VM for each config in a multi-machine setup? I don't need all VMs on at the same time, just one at a time. Each config file loads the sync folder.

This is my Vagrantfile so far:

Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.network :forwarded_port, host: 8080, guest: 80
config.vm.network "private_network", ip: "172.28.128.3"

config.vm.define "myoffercode" do |vm1|
    vm1.vm.synced_folder "/Users/gregoryschultz/Sites/myoffercode", "/var/www/html"
end

config.vm.define "dailybayou" do |vm2|
    vm2.vm.synced_folder "/Users/gregoryschultz/Sites/dailybayou", "/var/www/html"
end
end

--
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/1e56affb-53ae-44b0-910c-2b37d8b2f066%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Multi-machine Vagrant file to use one VM?

Rui Lopes
Instead of a single Vagrantfile for all of your projects, why don't you have a Vagrantfile inside of each of those projects? Its simpler that way, and you just need to go into the project directory and do a simple vagrant up.

Anyways, if you really want to use a single Vagrantfile, I don't quite understood you. Do you want to share the config.vm between the VMs and only change the synced_folder? if so, its a matter of placing the configuration outside the config.vm.define blocks.

On Friday, October 7, 2016 at 2:57:57 AM UTC+1, Gregory Schultz wrote:
Hello,

I design websites and would like to start using multi-machine setup. Is it possible to use one VM for each config in a multi-machine setup? I don't need all VMs on at the same time, just one at a time. Each config file loads the sync folder.

This is my Vagrantfile so far:

Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.network :forwarded_port, host: 8080, guest: 80
config.vm.network "private_network", ip: "172.28.128.3"

config.vm.define "myoffercode" do |vm1|
    vm1.vm.synced_folder "/Users/gregoryschultz/Sites/myoffercode", "/var/www/html"
end

config.vm.define "dailybayou" do |vm2|
    vm2.vm.synced_folder "/Users/gregoryschultz/Sites/dailybayou", "/var/www/html"
end
end

--
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/44a86dac-85c8-48d2-a6c2-9ba3e038d762%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Multi-machine Vagrant file to use one VM?

Alvaro Miranda Aguilera
In reply to this post by Gregory Schultz
Usually the Vagrantfile lives with the code, so is part of the version control, the provisioning scripts to create the VM can be used later to deploy the app/code into production, etc.

If you want to have a big Vagrantifile like that, it will work, there is a way to stop the VMs starting if you do a vagrant up, add  autostart: false to the define.

At the end, use what ever make more sense for your workflow :)

Alvaro.

On Fri, Oct 7, 2016 at 3:57 AM, Gregory Schultz <[hidden email]> wrote:
Hello,

I design websites and would like to start using multi-machine setup. Is it possible to use one VM for each config in a multi-machine setup? I don't need all VMs on at the same time, just one at a time. Each config file loads the sync folder.

This is my Vagrantfile so far:

Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.network :forwarded_port, host: 8080, guest: 80
config.vm.network "private_network", ip: "172.28.128.3"

config.vm.define "myoffercode" do |vm1|
    vm1.vm.synced_folder "/Users/gregoryschultz/Sites/myoffercode", "/var/www/html"
end

config.vm.define "dailybayou" do |vm2|
    vm2.vm.synced_folder "/Users/gregoryschultz/Sites/dailybayou", "/var/www/html"
end
end

--
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/1e56affb-53ae-44b0-910c-2b37d8b2f066%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/CAHqq0ey-h6Pf6UFHUUJxS1MczJt1gqb1dUqkXX9aM_wFffDURA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.