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

    Better / more flexible way to add and edit CloudInit templates in XO ?

    Scheduled Pinned Locked Moved Infrastructure as Code
    5 Posts 3 Posters 65 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.
    • HolgiBH Offline
      HolgiB
      last edited by

      Sorry if this has been asked before but just recently I started to play around a bit with CloudInit to make provisioning of Linux VMs in our XCP-ng intrastructure a bit easier.

      Dealing with Cloud Init files itself is already not really easy but XO makes this even harder because of the tiny edit window inside the web gui. I know that for more complex tasks using Cloud Init together with Terraform / Open Tofu plus the XO provider is the better way to go but for the beginning it would help to have a true editor inside the WebGUI (may be with YAML syntax validation) plus an easier way to manage various Cloud Init files (e.g. Network #1 fixed IP / Network #2 fixed IP / Network #1 DHCP / etc). Some sort of file / config manager that allows to easily import and export cloud configs to /from external storage.

      V sidS 2 Replies Last reply Reply Quote 0
      • V Offline
        vmpr @HolgiB
        last edited by

        Hi @HolgiB - we have all our different cloud init files in a git repository plus the network files with the static ip configuration for the virtual machines, so we can track every change and have the configs handy instantly. I do changes in my IDE and copy the content of the file to xo when i install a new machine. Maybe that helps you with your workflow and makes it easier to edit and deploy. Cheers Ringo

        1 Reply Last reply Reply Quote 0
        • sidS Offline
          sid @HolgiB
          last edited by

          @HolgiB via Settings → Cloud configs you can already store some pre-made configs, for example the DHCP ones.

          However it might not be a good solution for your fixed-IP configs, as you might forget to replace the fixed network settings and end up launching a VM with incorrect settings.

          And yes, I also wish those textareas used all the available horizontal space.

          As @vmpr mentioned, keeping them in version control sounds like a good plan, and also means you can make your own web tool which can validate / prompt for input based on your templates.

          1 Reply Last reply Reply Quote 0
          • HolgiBH Offline
            HolgiB
            last edited by

            Thanks for your replies ! Yes, using both an external editor plus some sort of revision control (Git, SVN, etc) makes perfectly sense but somewhat destroys the user experience of XO having everything to administrate, create and backup all the VMs in your infrastructure in the first place. 🙂

            I for example had issues with hashed password for new users being generated via CloudInit and it took me quite some time to find out what causes my user generation to fail. Everyone dealing with CloudInit a lot more than I do will agree that those init files often are technically correct but still fail for some strange reason where you need to find out a workaround. So adding another limitation like those strangely small edit boxes for something that would easily need a screenwide text box does not really make sense to me. If you edit preconfigure init files it would be nice to simply have a "save" button for example.

            I am not really a web dev but I guess there would be available text editor components for fill this gap without needing 20 man days to implement such a feature. All this Terraform / Open Tofu stuff is nice but I guess generating VMs via Cloud Init and XO will be the entry level for everyone before trying out a much bigger infrastructure as code solution, right ?

            sidS 1 Reply Last reply Reply Quote 0
            • sidS Offline
              sid @HolgiB
              last edited by

              @HolgiB said in Better / more flexible way to add and edit CloudInit templates in XO ?:

              All this Terraform / Open Tofu stuff is nice but I guess generating VMs via Cloud Init and XO will be the entry level for everyone before trying out a much bigger infrastructure as code solution, right ?

              Starting to use Terraform is not a big step, and it's how I manage even a small setup with < 20 VMs, though not everything can be managed that way, for example SRs cannot currently be created through terraform, so XO is still needed too.

              those init files often are technically correct but still fail for some strange reason

              I agree, debugging cloud-init is not a fun task. I don't know if it is an approach you could take, but in my case I keep my cloud-init extremely simple. It only sets up networking and a single fixed user account with an SSH key. Then other tooling, for example Ansible, takes over from there to configure the VM.

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