Node dependency

26 views
Skip to first unread message

Shyam Biradar

unread,
Aug 21, 2016, 3:51:36 AM8/21/16
to Vagrant
Hello Team

I am facing a issue here.

My vagrantfile creats two vms(vm1, vm2)
But some configurations of vm1 need to be done after vm2. Flow is like this.
1. Create Vm1 , configure : Done
2. Create Vm2, configure : Done
3. Additional Configurion of Vm1: Need help here

How can I specify step 3 in Vagrantfile.

You can take shell as example for configuaration.

Alvaro Miranda Aguilera

unread,
Aug 21, 2016, 11:46:49 AM8/21/16
to vagra...@googlegroups.com
Hello

Vagrant run tops to bottom.

So you can do

VM2
VM1

# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!

VAGRANTFILE_API_VERSION = "2"


Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|

  config.vm.box = "hashicorp/precise64"


  #this is global, will be run on both nodes, ie normal provision

  config.vm.provision "shell", inline: "hello global provision"


  config.vm.define "n2" do |n2|

      n2.vm.hostname = "n2"

  end


  config.vm.define "n1" do |n1|

      n1.vm.hostname = "n1"

      #this is n1 local, at this point n2 already exists.

      n1.vm.provision "shell", inline: "hello n1 provision"

  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 vagrant-up+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/a9f5e9ec-4612-4d0e-8a45-e69ddf44bcd5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

Shyam Biradar

unread,
Aug 21, 2016, 11:56:41 AM8/21/16
to vagra...@googlegroups.com
Thanks, but my scenarios is different.
1. launch vm1
2. launch vm2
3. Configure vm1 
4. Configure vm2


Steps 3&4 are dependent on step 1&2.
I can't run step 3 or 4 until both step 1&2 gets completed.

How can I do that in Vagrant.
You received this message because you are subscribed to a topic in the Google Groups "Vagrant" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/vagrant-up/28enLRixabk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to vagrant-up+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/CAHqq0exkJbqqRvnAmPu91fTXLRBDQ8D_ANWggBtTZur_2OMUbw%40mail.gmail.com.

For more options, visit https://groups.google.com/d/optout.


--
Thanks & Regards,
Shyam Biradar,
Contact: +91 8600266938.

Alvaro Miranda Aguilera

unread,
Aug 21, 2016, 1:13:20 PM8/21/16
to vagra...@googlegroups.com
same principle

# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  config.vm.box = "hashicorp/precise64"

  config.vm.define "n1" do |n1|
      n1.vm.hostname = "n1"
      #this is n1 local, at this point n2 does not exists.
      n1.vm.provision "shell", inline: "hello n1 provision"
  end

  config.vm.define "n2" do |n2|
      n2.vm.hostname = "n2"
      #this is n2 local, at this point n1 already exists.
      n2.vm.provision "shell", inline: "hello n2 provision"
  end
end

Shyam Biradar

unread,
Aug 22, 2016, 4:48:45 AM8/22/16
to vagra...@googlegroups.com
Ok.

Now the question is,

Once I am done with both vms, how can I go I back and configure first VM?

My doubt is whenever we say config.vm.define, does is create new vm?

If yes, then how can I just run some configurations on already running vm(Created by same Vagrantfile in previous steps) through Vagrantfile?






Thanks & Regards,
Shyam Biradar,
Contact: +91 8600266938.

--
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 a topic in the Google Groups "Vagrant" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/vagrant-up/28enLRixabk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to vagrant-up+unsubscribe@googlegroups.com.

Chris Roberts

unread,
Aug 24, 2016, 11:44:29 AM8/24/16
to vagra...@googlegroups.com
Hi! 

Once I am done with both vms, how can I go I back and configure first VM?

The functionality you're describing is not currently implemented within vagrant, however, it is functionality that I intend to implement in the future. Currently vagrant will start and provision instances in order.


> My doubt is whenever we say config.vm.define, does is create new vm?

The Vagrantfile is a configuration file, and as such is processed prior starting and provisioning the instances.

Cheers!

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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/CA%2B8yFHY%2B96spxKMNKEyGXi34o7PzU7HN610uvLr9haS1pTg1fQ%40mail.gmail.com.

Shyam Biradar

unread,
Aug 25, 2016, 12:50:44 AM8/25/16
to vagra...@googlegroups.com
Ok, thanks.

Thanks & Regards,
Shyam Biradar,
Contact: +91 8600266938.

Reply all
Reply to author
Forward
0 new messages