grtjn / mlvagrant

Scripts for bootstrapping a local MarkLogic cluster for development purposes using https://www.vagrantup.com/ and https://www.virtualbox.org/.
Apache License 2.0
19 stars 16 forks source link

Setting static IP Address in clustered configuration #99

Closed ChrisDay-Australia closed 8 years ago

ChrisDay-Australia commented 8 years ago

Had to edit the Vagrantfile in order to get static IP addressing working with a cluster configuration.

Original Vagrantfile code:

    def inc_ip(ip, i)
      newip = "#{ip}"
      nr = "#{ip}"
      nr.gsub!(/^(.*\.)+/, "").to_i
      newip.gsub!(/\.\d+$/, ".#{nr + i}")
      newip
    end

Edited Vagrantfile code:

newip.gsub!(/.\d+$/, ".#{nr.to_i + i}")

    def inc_ip(ip, i)
      newip = "#{ip}"
      nr = "#{ip}"
      nr.gsub!(/^(.*\.)+/, "").to_i
      newip.gsub!(/\.\d+$/, ".#{nr.to_i + i}")
      newip
    end

Once edit in place, each node gets a static IP address based on the settings in the project.properties file.

grtjn commented 8 years ago

Looks like a very logical patch, thnx for reporting!