Wait for IP(v4) address similar to terraform
-
Is there anything similar to this in the xo-cli or API? I don't want to use Terraform or OpenTofu for this, as it significantly complicates the system I'm building.
Right now, I have a Python script that just waits 120 seconds before continuing to make sure the VM gets an IP address via DHCP and is reported properly. My only concern (even with Terraform/OpenTofu) is that Windows returns a 169.254.x.x address to XCP-ng tools almost immediately after fully booting. Is there a way to get around this?
-
Question for @nathanael-h @Butcat or @Cyrille
-
Hello @nick.lloyd, the logic of
expected_ip_cidr = "10.0.0.0/16"
is available in Terraform, not in XO. But as you're building a Python script you could implements there the same logic: define a variable for your expected cidr, and poll the IP of the VM until it matches.Else, as you're using Python, you might be interested by the Pulumi Python SDK we will release this month. It allows you to easily define your infrastructure as code like with Terraform, but using Python
There you will also have the expected_ip_cidr param, in Python..
https://pypi.org/project/pulumi-xenorchestra/
https://github.com/vatesfr/pulumi-xenorchestra/
https://www.pulumi.com/product/infrastructure-as-code/ -
@nathanael-h Dang, do any of you sleep?! This is pretty much what I need, and would actually significantly improve what I'm building! Will
wait_for_ip
be included? As well as the rest of the Terraform logic?But as you're building a Python script you could implements there the same logic: define a variable for your expected cidr, and poll the IP of the VM until it matches.
Duhh, Why didn't I think of that
. Thanks for the help!!