Problem with Vagrantfile launching machines

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

Problem with Vagrantfile launching machines

Vagrant mailing list
Hello. I'm working with Vagrant for the first time trying to create a bunch of VM's for a MongoDB cluster. I've stumbled quite quickly.

After executing "vagrant up" I receive the following error...


/Users/rhys1/Documents/vagrant/mongo/Vagrantfile:22:in `block (2 levels) in <top (required)>': undefined local variable or method `mongos1' for main:Object (NameError)
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/lib/vagrant/config/v2/loader.rb:37:in `call'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/lib/vagrant/config/v2/loader.rb:37:in `load'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/lib/vagrant/config/loader.rb:113:in `block (2 levels) in load'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/lib/vagrant/config/loader.rb:107:in `each'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/lib/vagrant/config/loader.rb:107:in `block in load'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/lib/vagrant/config/loader.rb:104:in `each'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/lib/vagrant/config/loader.rb:104:in `load'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/lib/vagrant/vagrantfile.rb:153:in `machine_config'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/lib/vagrant/environment.rb:333:in `default_provider'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/lib/vagrant/plugin/v2/command.rb:174:in `block in with_target_vms'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/lib/vagrant/plugin/v2/command.rb:201:in `call'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/lib/vagrant/plugin/v2/command.rb:201:in `block in with_target_vms'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/lib/vagrant/plugin/v2/command.rb:183:in `each'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/lib/vagrant/plugin/v2/command.rb:183:in `with_target_vms'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/plugins/commands/up/command.rb:131:in `install_providers'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/plugins/commands/up/command.rb:85:in `execute'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/lib/vagrant/cli.rb:42:in `execute'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/lib/vagrant/environment.rb:308:in `cli'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/bin/vagrant:123:in `<main>'

The content of my Vagrant file is as follows...

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

  config.vm.define "mongos1" do |mongos1|
    mongos1.vm.box = "centos/7"
    mongos1.vm.provision :shell, path: "bootstrap_mongos.sh"
  end
  
  config.vm.define "mongos2" do |mongos2|
    mongos2.vm.box = "centos/7"
    mongos2.vm.provision :shell, path: "bootstrap_mongos.sh"
  end
  
  config.vm.define "mongos3" do |mongos3|
    mongos3.vm.box = "centos/7"
    mongos3.vm.provision :shell, path: "bootstrap_mongos.sh"
  end  

  config.vm.define "mongod1" do |mongod1|
    mongod1.vm.box = "centos/7"
    mongos1.vm.provision :shell, path: "bootstrap_mongod.sh"
  end
  
  config.vm.define "mongod2" do |mongod2|
    mongod2.vm.box = "centos/7"
    mongos2.vm.provision :shell, path: "bootstrap_mongod.sh"
  end  
 
  config.vm.define "mongod3" do |mongod3|
    mongod3.vm.box = "centos/7"
    mongos3.vm.provision :shell, path: "bootstrap_mongod.sh"
  end  
 
   config.vm.define "mongod4" do |mongod4|
    mongod4.vm.box = "centos/7"
    mongos4.vm.provision :shell, path: "bootstrap_mongod.sh"
  end
  
  config.vm.define "mongod5" do |mongod5|
    mongod5.vm.box = "centos/7"
    mongos5.vm.provision :shell, path: "bootstrap_mongod.sh"
  end  
 
  config.vm.define "mongod6" do |mongod6|
    mongod6.vm.box = "centos/7"
    mongos6.vm.provision :shell, path: "bootstrap_mongod.sh"
  end  
  
end

Is anyone able to see what I am doing wrong?

Many thanks,

Rhys



 

--
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/9af7ee0f-0694-4f90-9291-d45ef44025ad%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Problem with Vagrantfile launching machines

Salty Vagrant

Ryhs:

Typos. You have mongos1 in your mongod1 and mongod2 blocks


On 15 Jul 2017, at 18:57, rhys.james.campbell via Vagrant wrote:

Hello. I'm working with Vagrant for the first time trying to create a bunch of VM's for a MongoDB cluster. I've stumbled quite quickly.

After executing "vagrant up" I receive the following error...


/Users/rhys1/Documents/vagrant/mongo/Vagrantfile:22:in `block (2 levels) in <top (required)>': undefined local variable or method `mongos1' for main:Object (NameError)
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/lib/vagrant/config/v2/loader.rb:37:in `call'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/lib/vagrant/config/v2/loader.rb:37:in `load'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/lib/vagrant/config/loader.rb:113:in `block (2 levels) in load'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/lib/vagrant/config/loader.rb:107:in `each'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/lib/vagrant/config/loader.rb:107:in `block in load'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/lib/vagrant/config/loader.rb:104:in `each'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/lib/vagrant/config/loader.rb:104:in `load'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/lib/vagrant/vagrantfile.rb:153:in `machine_config'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/lib/vagrant/environment.rb:333:in `default_provider'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/lib/vagrant/plugin/v2/command.rb:174:in `block in with_target_vms'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/lib/vagrant/plugin/v2/command.rb:201:in `call'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/lib/vagrant/plugin/v2/command.rb:201:in `block in with_target_vms'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/lib/vagrant/plugin/v2/command.rb:183:in `each'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/lib/vagrant/plugin/v2/command.rb:183:in `with_target_vms'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/plugins/commands/up/command.rb:131:in `install_providers'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/plugins/commands/up/command.rb:85:in `execute'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/lib/vagrant/cli.rb:42:in `execute'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/lib/vagrant/environment.rb:308:in `cli'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/bin/vagrant:123:in `<main>'

The content of my Vagrant file is as follows...

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

  config.vm.define "mongos1" do |mongos1|
    mongos1.vm.box = "centos/7"
    mongos1.vm.provision :shell, path: "bootstrap_mongos.sh"
  end
  
  config.vm.define "mongos2" do |mongos2|
    mongos2.vm.box = "centos/7"
    mongos2.vm.provision :shell, path: "bootstrap_mongos.sh"
  end
  
  config.vm.define "mongos3" do |mongos3|
    mongos3.vm.box = "centos/7"
    mongos3.vm.provision :shell, path: "bootstrap_mongos.sh"
  end  

  config.vm.define "mongod1" do |mongod1|
    mongod1.vm.box = "centos/7"
    mongos1.vm.provision :shell, path: "bootstrap_mongod.sh"
  end
  
  config.vm.define "mongod2" do |mongod2|
    mongod2.vm.box = "centos/7"
    mongos2.vm.provision :shell, path: "bootstrap_mongod.sh"
  end  
 
  config.vm.define "mongod3" do |mongod3|
    mongod3.vm.box = "centos/7"
    mongos3.vm.provision :shell, path: "bootstrap_mongod.sh"
  end  
 
   config.vm.define "mongod4" do |mongod4|
    mongod4.vm.box = "centos/7"
    mongos4.vm.provision :shell, path: "bootstrap_mongod.sh"
  end
  
  config.vm.define "mongod5" do |mongod5|
    mongod5.vm.box = "centos/7"
    mongos5.vm.provision :shell, path: "bootstrap_mongod.sh"
  end  
 
  config.vm.define "mongod6" do |mongod6|
    mongod6.vm.box = "centos/7"
    mongos6.vm.provision :shell, path: "bootstrap_mongod.sh"
  end  
  
end

Is anyone able to see what I am doing wrong?

Many thanks,

Rhys



 

--
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/9af7ee0f-0694-4f90-9291-d45ef44025ad%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
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/A6BD083A-1DF3-421E-8AD2-ED1EBDDE669E%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Problem with Vagrantfile launching machines

Vagrant mailing list
great. Thanks.

--
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/a72a2e75-054b-4073-a097-3e696d4e4f54%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Problem with Vagrantfile launching machines

Salty Vagrant
In reply to this post by Salty Vagrant
Oops. Typo myself :_ Sorry Rhys for misspelling your name

On Sunday, July 16, 2017 at 11:43:37 AM UTC+1, Salty Vagrant wrote:

Ryhs:

Typos. You have mongos1 in your mongod1 and mongod2 blocks


On 15 Jul 2017, at 18:57, rhys.james.campbell via Vagrant wrote:

Hello. I'm working with Vagrant for the first time trying to create a bunch of VM's for a MongoDB cluster. I've stumbled quite quickly.

After executing "vagrant up" I receive the following error...


/Users/rhys1/Documents/vagrant/mongo/Vagrantfile:22:in `block (2 levels) in <top (required)>': undefined local variable or method `mongos1' for main:Object (NameError)
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/lib/vagrant/config/v2/loader.rb:37:in `call'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/lib/vagrant/config/v2/loader.rb:37:in `load'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/lib/vagrant/config/loader.rb:113:in `block (2 levels) in load'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/lib/vagrant/config/loader.rb:107:in `each'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/lib/vagrant/config/loader.rb:107:in `block in load'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/lib/vagrant/config/loader.rb:104:in `each'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/lib/vagrant/config/loader.rb:104:in `load'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/lib/vagrant/vagrantfile.rb:153:in `machine_config'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/lib/vagrant/environment.rb:333:in `default_provider'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/lib/vagrant/plugin/v2/command.rb:174:in `block in with_target_vms'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/lib/vagrant/plugin/v2/command.rb:201:in `call'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/lib/vagrant/plugin/v2/command.rb:201:in `block in with_target_vms'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/lib/vagrant/plugin/v2/command.rb:183:in `each'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/lib/vagrant/plugin/v2/command.rb:183:in `with_target_vms'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/plugins/commands/up/command.rb:131:in `install_providers'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/plugins/commands/up/command.rb:85:in `execute'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/lib/vagrant/cli.rb:42:in `execute'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/lib/vagrant/environment.rb:308:in `cli'
from /opt/vagrant/embedded/gems/gems/vagrant-1.9.0/bin/vagrant:123:in `<main>'

The content of my Vagrant file is as follows...

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

  config.vm.define "mongos1" do |mongos1|
    mongos1.vm.box = "centos/7"
    mongos1.vm.provision :shell, path: "bootstrap_mongos.sh"
  end
  
  config.vm.define "mongos2" do |mongos2|
    mongos2.vm.box = "centos/7"
    mongos2.vm.provision :shell, path: "bootstrap_mongos.sh"
  end
  
  config.vm.define "mongos3" do |mongos3|
    mongos3.vm.box = "centos/7"
    mongos3.vm.provision :shell, path: "bootstrap_mongos.sh"
  end  

  config.vm.define "mongod1" do |mongod1|
    mongod1.vm.box = "centos/7"
    mongos1.vm.provision :shell, path: "bootstrap_mongod.sh"
  end
  
  config.vm.define "mongod2" do |mongod2|
    mongod2.vm.box = "centos/7"
    mongos2.vm.provision :shell, path: "bootstrap_mongod.sh"
  end  
 
  config.vm.define "mongod3" do |mongod3|
    mongod3.vm.box = "centos/7"
    mongos3.vm.provision :shell, path: "bootstrap_mongod.sh"
  end  
 
   config.vm.define "mongod4" do |mongod4|
    mongod4.vm.box = "centos/7"
    mongos4.vm.provision :shell, path: "bootstrap_mongod.sh"
  end
  
  config.vm.define "mongod5" do |mongod5|
    mongod5.vm.box = "centos/7"
    mongos5.vm.provision :shell, path: "bootstrap_mongod.sh"
  end  
 
  config.vm.define "mongod6" do |mongod6|
    mongod6.vm.box = "centos/7"
    mongos6.vm.provision :shell, path: "bootstrap_mongod.sh"
  end  
  
end

Is anyone able to see what I am doing wrong?

Many thanks,

Rhys



 

--
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 [hidden email].
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/vagrant-up/9af7ee0f-0694-4f90-9291-d45ef44025ad%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/9af7ee0f-0694-4f90-9291-d45ef44025ad%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/vagrant-up/9af7ee0f-0694-4f90-9291-d45ef44025ad%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/d/msgid/vagrant-up/9af7ee0f-0694-4f90-9291-d45ef44025ad%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.

--
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/572133d4-47df-48ca-ba49-8ac10412591a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Problem with Vagrantfile launching machines

Salty Vagrant
In reply to this post by Vagrant mailing list
Rhys

Actually, you have a few other typos in there too. Check your mongod blocks, they all have mongos in them :)

On Sunday, July 16, 2017 at 11:45:38 AM UTC+1, [hidden email] wrote:
great. Thanks.

--
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/adbbfa7c-b65b-4260-ace8-85cd098e3828%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.