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

    Cloudbase-init on Windows

    Scheduled Pinned Locked Moved Advanced features
    22 Posts 6 Posters 525 Views 6 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.
    • A Online
      Andrew7 @dinhngtu
      last edited by

      @dinhngtu

      Thank you for the replay.

      I understand that cloudbase-init is a way to go. I did similar config to @jkatz and don't know why it doesn't work for me.
      I did exactly as you suggested, created Cloud Config settings in XO and then use that during deployment screen.
      fb2c70d1-6189-4602-9808-aec119f9ac0c-image.png

      I've tried to set it up with this guide
      https://docs.xen-orchestra.com/vm-templates

      So I've added those fields :
      config_drive_vfat=true
      ...
      metadata_services=cloudbaseinit.metadata.services.nocloudservice.NoCloudConfigDriveService
      plugins=cloudbaseinit.plugins.common.userdata.UserDataPlugin

      into config files.

      I'm probably doing something wrong but I don't know where to look.
      It seems that cloudbase-init doesn't even start or it is skipped because my input is totally incorrect in those "User config " and "Network Config" fields.

      The log folder here is empty
      f22f1716-fa3e-46de-be19-6edb70f06377-image.png

      Do you have any ideas why it doesn't work ?
      It might be the case that I'm just an idiot and did some rookie mistake as I have never used cloudbase-init before.
      So, I don't really know if the problem is my Custom Config settings in XO or cloudbase-init config on VM.

      @dinhngtu said in Cloudbase-init on Windows:

      As for Sysprep support specifically, I've put in a request to the XO team, although I can't promise anything specific for now.

      Thank you.

      D 1 Reply Last reply Reply Quote 0
      • D Offline
        dinhngtu Vates 🪐 XCP-ng Team @Andrew7
        last edited by dinhngtu

        @Andrew7 Did you Sysprep the template using cloudbase-init's included Unattend.xml file? That file is needed to invoke cloudbase-init after the image is unsealed.

        For the cloudbase-init configuration, you only need to add the following line to both of its config files:

        metadata_services=cloudbaseinit.metadata.services.nocloudservice.NoCloudConfigDriveService
        

        No need to add any other line to cloudbase-init.conf unless you want to enable/disable specific plugins.

        I'm preparing an updated guide for Windows VM template creation: https://github.com/vatesfr/xen-orchestra/pull/8575. Stay tuned.

        dinhngtu opened this pull request in vatesfr/xen-orchestra

        open docs(XO): add Windows cloudbase-init template guide #8575

        D A 2 Replies Last reply Reply Quote 0
        • D Offline
          dinhngtu Vates 🪐 XCP-ng Team @dinhngtu
          last edited by

          @jkatz I'm talking with the DevOps team to see if there's a way to discover/configure networking, perhaps via additional metadata provided through the cloud config drive.

          1 Reply Last reply Reply Quote 0
          • A Online
            Andrew7 @dinhngtu
            last edited by Andrew7

            @dinhngtu
            Hello again,

            Thanks for replay.
            I did it all over again ( new cloudbase-init installation on new VM ), and used @jkatz config and it partially worked.

            This was my settings just before OS shutdown
            e3e8a1aa-fd75-4b1e-99fe-0effc9bfd422-image.png

            And this is the output, new VM and it's settings
            addb8e69-d0d9-4d64-b496-9407cdf3a89a-image.png

            What hasn't change during deployment is the host name. Network setting were changed according to Network Config file from XO.
            Sysprep was also done.

            So I will have to figure out why the hostname hasn't changed according to the XO Users Config.

            D 1 Reply Last reply Reply Quote 0
            • J Offline
              jkatz @Andrew7
              last edited by

              @Andrew7
              Sounds like I'm in the same boat as you in trying to find an alternative to vmware for a fairly large deployment. And the PoC / testing will probably take around 6-12 months before we commit to any new platform. So support during the one month trial period isn't quite enough.

              I would agree that the customization specifications in vcenter are easy to use and quite polished. But I do think cloudbase-init can get the minimal job done where the hostname and ip gets configured during deployment. Then i can rely on our automation tools to take it to the end. The only stopping point right now is exposing the new MAC address to the network config as a variable. But it sounds like that is hopefully being addressed.

              Originally, i would install cloudbase, and not do the sysprep there and not shutdown. Then i would modify the cloudbase-init.conf. then sysprep manually, then shutdown. I think (been a while, but i have it written down in a onenote) this worked except for the newer OSs like 11 and 2025. So now my process is to let the cloudbase installer do the sysprep but not shutdown. I think the cloudbase sysprep does something a little different than just running it manually. Then i modify the config, then shutdown. Convert to template.

              I think for 11 I also changed the administrator user to not 'user must change password'. That may or may not be needed.

              Also, if the recovery partition is put after the primary, you'll want to nuke it so that the disk can be resized during deployment.

              If you still can't get it working, i'll revisit my steps here to verify my process. Lemme know and I'll check.

              1 Reply Last reply Reply Quote 0
              • D Offline
                dinhngtu Vates 🪐 XCP-ng Team @Andrew7
                last edited by dinhngtu

                @Andrew7 @jkatz Did you use the cloudbase-init unattend.xml for sysprep? I also recommend starting your template from audit mode.

                I've done several tests with my procedures from the PR linked above, and managed to set the VM's hostname.

                vm.png

                J A 2 Replies Last reply Reply Quote 0
                • J Offline
                  jkatz @dinhngtu
                  last edited by

                  @dinhngtu

                  I'm testing this out on my test environment. But it have to rebuild the template as we borked the site where the templates were at.

                  MS introduced some bugs in some xapps in a recent patch cycle that breaks sysprep. I noticed this when i was creating a template in our vcenter environment. I'm currently using this ISO for my template build:

                  SW_DVD9_Win_Server_STD_CORE_2022_2108.31_64Bit_English_DC_STD_MLF_X23-71666.ISO

                  And then not applying any patches. That works for me in vcenter, but once I apply current patches, then it will not customize anymore. Not sure if it applies here in XO, but i thought i'd throw that out there too.

                  D 1 Reply Last reply Reply Quote 0
                  • D Offline
                    dinhngtu Vates 🪐 XCP-ng Team @jkatz
                    last edited by

                    @jkatz Do the issues occur even if the template was prepared from audit mode?

                    J 1 Reply Last reply Reply Quote 0
                    • A Online
                      Andrew7 @dinhngtu
                      last edited by Andrew7

                      @dinhngtu
                      Still nothing. I've tried use only :
                      #cloudbase-config
                      hostname: VMName

                      I can also confirm what @jkatz discovered. When there is no MAC address in Network Config the static IP setup doesn't work.

                      @jkatz Yes, it seems that we are on the same boat.

                      How did you make that hostname change works ?

                      @dinhngtu What this audit mode does ?

                      @dinhngtu said in Cloudbase-init on Windows:

                      Did you use the cloudbase-init unattend.xml for sysprep?

                      There was that file on disk and I saw that it had a config in it. I have not touched it in any way.

                      A 1 Reply Last reply Reply Quote 0
                      • A Online
                        Andrew7 @Andrew7
                        last edited by

                        By the way, how to edit Template ?

                        J 1 Reply Last reply Reply Quote 0
                        • J Offline
                          jkatz @dinhngtu
                          last edited by

                          @dinhngtu

                          Didn't bother with manual sysprep anymore. I just let the installer start it.

                          1 Reply Last reply Reply Quote 0
                          • J Offline
                            jkatz @Andrew7
                            last edited by

                            @Andrew7

                            You don't. Pretty sure there is a dialog stating this is not reversable when setting a VM as a template.

                            What I do is have a source vm and then take a snapshot of it while off. Then create a vm off that snap. Can do versioning this way. Boot the new vm (from the snap), install cloudbase, copy over the cloudbase-init.conf over, shutdown, convert to template.

                            I also created my own ISO with the citrix tools, cloudbase installer, and cloudbase config to make it easier.

                            Making the hostname update was probably the first thing that got working. Check my cloud-config at the top. That should work. Just be sure to add those last three lines to the cloudbase config too.

                            And the only file i change is cloudbase-init.conf.

                            A 1 Reply Last reply Reply Quote 0
                            • A Online
                              Andrew7 @jkatz
                              last edited by

                              @jkatz Thanks for that.

                              I actually did something different but it worked. I don't know how but it is working.

                              I used this in XO in Cloud Config
                              a5f1ca37-802a-4ff4-bc4f-6c8ccaa3dc97-image.png

                              It worked
                              e2666c29-8a03-41e1-879b-b6559b7f0bf2-image.png

                              Don't know if does it matter or not ( probably does) that I also entered this plugin into both files :
                              cloudbaseinit.plugins.common.sethostname.SetHostNamePlugin

                              @jkatz said in Cloudbase-init on Windows:

                              You don't.

                              That is lame.

                              Wonder if domain join is possible with that...

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