XCP-ng
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Wait for IP(v4) address similar to terraform

    Scheduled Pinned Locked Moved Management
    4 Posts 3 Posters 117 Views 3 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • nick.lloydN Offline
      nick.lloyd
      last edited by

      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?

      1 Reply Last reply Reply Quote 0
      • olivierlambertO Offline
        olivierlambert Vates 🪐 Co-Founder CEO
        last edited by

        Question for @nathanael-h @Butcat or @Cyrille

        1 Reply Last reply Reply Quote 0
        • nathanael-hN Offline
          nathanael-h Vates 🪐 DevOps Team
          last edited by

          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/

          nick.lloydN 1 Reply Last reply Reply Quote 0
          • nick.lloydN Offline
            nick.lloyd @nathanael-h
            last edited by

            @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!!

            1 Reply Last reply Reply Quote 1
            • First post
              Last post