GithubHelp home page GithubHelp logo

Comments (7)

kris-luminar avatar kris-luminar commented on July 18, 2024

I'm having the same issue. Did you ever resolve this?

from vagrant-vsphere.

kris-luminar avatar kris-luminar commented on July 18, 2024

Also, what goes in the customization_spec_name file? I haven't found any examples anywhere online.

from vagrant-vsphere.

marnovdm avatar marnovdm commented on July 18, 2024

I think this plugin only supports setting a static IP at the moment, I've looked around in the code and see no evidence of handling DHCP. I've worked around this in our environment by giving the template I clone from a NIC which is already in the DHCP network and setup correctly, that way it automatically comes online with a DHCP IP.

from vagrant-vsphere.

StevenArmstrong avatar StevenArmstrong commented on July 18, 2024

It doesn't work with DHCP, I just created a token in the vagrant file then scripted the assignment to the vagrant file using an nmap command which polled to find a free ip.

from vagrant-vsphere.

kris-luminar avatar kris-luminar commented on July 18, 2024

I just created a token in the vagrant file then scripted the assignment to the vagrant file using an nmap command which polled to find a free ip.

@StevenArmstrong can you please provide an example or point me to a resource to help me understand that?

I know I can find a list of used ports using something like this example http://serverfault.com/a/153779/69882

from vagrant-vsphere.

StevenArmstrong avatar StevenArmstrong commented on July 18, 2024

Basically my vagrant file has web_config.vm.network 'private_network', ip: '$web_static_ip' token value where the static ip is set. I wrote a script that will find the $web_static_ip token and replace it with a desired ip. So this script does a simple token replacement on the vagrant file and I run a vagrant up command once that is done. To find that token value (i.e a unique ip that isnt used) I run a script before that which will take in a subnet variable (e.g 192.168.55.0) and will trigger an incrementing nmap command, so it will try 192.168.55.1 then 192.168.55.2 and so on until it finds a a free ip (nmap can be downloaded from here http://nmap.org/download.html) and if nmap returns host is down then I return the ip as it is free. For example if nmap -PR 192.168.55.3 is down it is then passed as the token replacement variable in the vagrantfile and I run a vagrant up after to up my VM. This way it replicates what DHCP is doing, and I assign the vagrantfile a free ip each time using the vagrant up using the working static ip method that you have proven works. I actually use this method to create multiple unique folders to vagrant up multiple vagrantfiles in parallel in seperate folders with different ips on the same server. Code wise my nmap code is embedded in c# msbuild custom task. So depending on the programming language you are using for scripting it may be easier to just replicate those high level steps yourself.

Process p = new Process();

                int exit = 0;

                while (exit == 0)
                {
                    counter++;
                    // Redirect the output stream of the child process.
                    p.StartInfo.UseShellExecute = false;
                    p.StartInfo.RedirectStandardOutput = true;
                    Log.LogMessage("Running cmd.exe /C nmap -sP " + NetworkIPAddress + counter);
                    p.StartInfo.FileName = "cmd.exe";
                    p.StartInfo.Arguments = "/C nmap -sP " + NetworkIPAddress + counter;
                    p.Start();
                    // Do not wait for the child process to exit before
                    // reading to the end of its redirected stream.
                    // p.WaitForExit();
                    // Read the output stream first and then wait.
                    string output = p.StandardOutput.ReadToEnd();
                    p.WaitForExit();
                    if (p.ExitCode == 0)
                    {

                    }
                    else
                    {
                        Log.LogMessage(string.Format("nmap -sP command has not run correctly:{0}", p.ExitCode));

                        return false;
                    }
                    Log.LogMessage("" + output);


                    Match match = Regex.Match(output, @".*Host seems down.*", RegexOptions.IgnoreCase);
                    if (match.Success)
                    {
                        //check for ping success?

                        exit = 1;
                    }
                    else
                    {
                        exit = 0;

                    }

                }

                Log.LogMessage("Pass IP to vagrant:" + NetworkIPAddress + counter);

from vagrant-vsphere.

kris-luminar avatar kris-luminar commented on July 18, 2024

Thanks for the response @StevenArmstrong

from vagrant-vsphere.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.