Multiple VMs from a single vagrant file?

As far as I can tell, there's no support for integrating multiple VMs from a VagrantFile is there?

As I have a bunch of VMs defined in my VagrantFile like

web
service
mobile

It seems like you can only have one VM defined. However I'd love to be told differently!
0
4 comments
Avatar
Permanently deleted user
Hi Cong,

you are not right=)
please review our blog post on Vagrant:
http://blog.jetbrains.com/pycharm/2013/03/how-pycharm-helps-you-with-remote-development/

So, in this blog post you can see example of one VM setup and run.
However the same is applicable for several VMs. You can add several boxes in Settings|{Project Settings}|Vagrant:
image1

and then you will be able to edit vagrant file by PyCharm:
image2


please follow http://docs.vagrantup.com/v2/multi-machine/index.html
to set everything properly in Vagrantfile.

and then just:
image3


so thus it will up all your machines according to vagrantfile.

I hope i answered your question. If not, feel free to ask again.
0
Avatar
Permanently deleted user
I probably worded my request poorly. Here's how my VagrantFile looks,

VagrantFile
Vagrant.configure("2") do |config|

    config.vm.box = "pycharmIsAwesome-centos-6"
    config.vm.provider :virtualbox do |vb|
        vb.customize ['setextradata', :id, 'VBoxInternal2/SharedFoldersEnableSymlinksCreate/app', '1']
        vb.customize ["guestproperty", "set", :id, "--timesync-set-threshold", 1000]
    end

    config.vm.synced_folder "../app", "/opt/pycharmIsAwesome/app"
    config.vm.synced_folder "../pycharmIsAwesome-svc", "/opt/pycharmIsAwesome/pycharmIsAwesome-svc"

    config.vm.define :db do |db_config|
        config.vm.provider :virtualbox do |vb|
            vb.name = "db"
        end
        db_config.vm.provision :chef_solo do |chef|
            chef.cookbooks_path = "../chef-repo/cookbooks"
            chef.roles_path = "../chef-repo/roles"
            chef.data_bags_path = "../chef-repo/data_bags"
            chef.add_recipe("yum::epel")
            chef.add_recipe("yum::pycharmIsAwesome")
            chef.add_recipe("cassandra::server")
            chef.add_recipe("mysql::server")
            chef.add_role("solo-dev")
        end
        db_config.vm.network :private_network, ip: "192.168.50.102"
    end

    config.vm.define :services do |services_config|
        config.vm.provider :virtualbox do |vb|
            vb.name = "services"
        end
        services_config.vm.provision :chef_solo do |chef|
            chef.cookbooks_path = "../chef-repo/cookbooks"
            chef.roles_path = "../chef-repo/roles"
            chef.data_bags_path = "../chef-repo/data_bags"
            chef.add_role("solo-dev")
            chef.add_role("services")
        end
        services_config.vm.network :private_network, ip: "192.168.50.104"
    end

    config.vm.define :web do |web_config|
        config.vm.provider :virtualbox do |vb|
            vb.name = "web"
        end
        web_config.vm.provision :chef_solo do |chef|
            chef.cookbooks_path = "../chef-repo/cookbooks"
            chef.roles_path = "../chef-repo/roles"
            chef.data_bags_path = "../chef-repo/data_bags"
            chef.add_role("solo-dev")
            chef.add_role("web-retail")
        end
        web_config.vm.network :private_network, ip: "192.168.50.101"
        web_config.vm.network :forwarded_port, guest: 80, host: 8080
    end

    config.vm.define :rpm do |rpm_config|
        config.vm.provider :virtualbox do |vb|
            vb.name = "rpm"
        end
        rpm_config.vm.synced_folder "../rpm.pycharmIsAwesome.com", "/opt/pycharmIsAwesome/pycharmIsAwesome-repo"
        rpm_config.vm.provision :chef_solo do |chef|
            chef.cookbooks_path = "../chef-repo/cookbooks"
            chef.roles_path = "../chef-repo/roles"
            chef.data_bags_path = "../chef-repo/data_bags"
            chef.add_recipe("yum::epel")
            chef.add_recipe("yum::pycharmIsAwesome")
            chef.add_recipe("rpmdev")
            chef.add_recipe("java::oracle")
        end
    end
end


As you can see I use a single box for about 3-4 seperate VMs. I haven't found a way to let PyCharm incorporate all of them easily.
0
Avatar
Permanently deleted user
Hi Cong,

ok... So when you do UP from PyCharm with this vagrantfile what happens? If all VMs really become up?
What are you expecting and what doesn't happen? What do you mean by "I haven't found a way to let PyCharm incorporate all of them easily."?

To use several VMs in one project you need to setup several remote interpreters for this project... Create several run/debug configurations and launch them separately...
0
Avatar
Permanently deleted user
All VMs are affected when I issue any vagrant command. Ideally I'd like more granular control on which VMs come up.
0

Please sign in to leave a comment.