Comments (7)
I'm having the same issue. Did you ever resolve this?
from vagrant-vsphere.
Also, what goes in the customization_spec_name
file? I haven't found any examples anywhere online.
from vagrant-vsphere.
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.
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.
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.
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.
Thanks for the response @StevenArmstrong
from vagrant-vsphere.
Related Issues (20)
- How to define multi-machine vagrantfile using different vm templates? HOT 2
- error-exit ["VagrantPlugins::VSphere::Errors::VSphereError", "execution expired"]
- undefined method `[]' for nil:NilClass after setting host name
- No setting for command timeout
- Is this project still maintained? HOT 1
- vagrant-vsphere install fails on vagrant 2.2.7
- Vagrant Configures with IPv6 instead of IPv4 HOT 1
- Specifying IPv4 address removes default gateway HOT 1
- Vagrantfile to manage existing VMs HOT 1
- Authentication to vCenter with 2FA TOTP
- Is there still active maintainers for this project ? HOT 1
- 400 Error when downloading vsphere-dummy box
- "can't modify frozen String" error on vagrant-vsphere 1.14.0 HOT 1
- vagant loop weird HOT 2
- Which vSphere Version?
- Cannot install in vagrant 2.3.4 from Debian HOT 2
- Prompt vsphere password programatically HOT 1
- Test issue for GH actions
- Test issue for GH actions - part two
- Test out GH actions
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vagrant-vsphere.