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

    Cloudbase-init on Windows

    Scheduled Pinned Locked Moved Advanced features
    21 Posts 6 Posters 497 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.
    • J Offline
      jkatz
      last edited by

      I've been working on getting Windows deployments (2022 in particular) to customize with Cloudbase-init.

      So far I have it:

      • Updating the hostname
      • Updating the administrator account's password
      • Running a command
      • And configuring the NIC with a static IP when supplied with the MAC address.

      If I don't supply the MAC in the network config, then cloudbase-init throws a bunch of errors in the log looking for the address and does not set the static IP. It doesn't make sense as their doc states that the field is optional. But seems to be necessary to find the NIC.

      So to make it work, I need to specify a MAC address in XO when creating the VM. And then paste that into the network config yaml.

      So is there a template variable for MAC like there is for {name} and {index} ? And if not... can we get one?

      The working network config:
      network:
      version: 1
      config:
      - type: physical
      name: eth0
      mac_address: "56:a7:01:38:75:3f"
      subnets:
      - type: static
      address: 192.168.1.3/24
      gateway: 192.168.1.1
      dns_nameservers:
      - 192.168.1.2
      dns_search:
      - company.name

      Or am I just doing it wrong?

      Thanks!
      jonathan

      O D 2 Replies Last reply Reply Quote 1
      • O Offline
        onthegrid @jkatz
        last edited by onthegrid

        Would you mind sharing your cloudbase conf and yaml files to get that far?

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

          @onthegrid Sure!

          So with the network config above. Gotta make your own MAC address and have it match the one in the interface field when cloning the template. (Variable would be nice here.)

          Cloud config in XO:
          55ba86a2-e4cb-4d8a-b3b3-904d1bb1fa38-image.png

          Installed cloudbase with defaults. Did not run sysprep. Did not reboot. I plan to handle those IDs later. And trying to sysprep Windows 11 didn't work/broke.

          Cloudbase-init.conf:
          6f8df03b-510f-48e5-9c0a-a42de0593eef-image.png

          If i recall correctly, it was just the last three lines I changed/added. Tested on Server 2022 and Windows 11. If we do go into produciton on this platform, I'll do the other config stuff later. I just wanted to make sure I could get the OS config'd with an IP, update the hostname, and reset the administrator password.

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

            @jkatz
            Hi,
            I'm trying to do the same thing.
            So, did you just shutdown the VM after cloudbase init installation and do the changes in config files ?
            Which one you change unattended ?
            How will you manage sysprep ?

            I came from VMware world, and everything there just works.
            Here you have to put your problem on forum ( most of them are just basic/standard VM deployment and administration stuff ) and pray for an answer with a resolution.

            Best regards

            D J 2 Replies Last reply Reply Quote 0
            • olivierlambertO Offline
              olivierlambert Vates 🪐 Co-Founder CEO
              last edited by

              @Andrew7 this mindset won't be really constructive if you want some free assistance on a free product.

              @dinhngtu might help if he's around.

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

                @Andrew7 said in Cloudbase-init on Windows:

                I came from VMware world, and everything there just works.
                Here you have to put your problem on forum ( most of them are just basic/standard VM deployment and administration stuff ) and pray for an answer with a resolution.

                Best regards

                You're welcome to go back to VMWare as well.

                As the saying goes, "if you're free to stay, you're free to go".

                If you want to buy support for your environment then do so and you can create a private ticket with the Vates company and not have to post on the forums. You can't have your cake and eat it too.

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

                  @DustinB

                  No problem.
                  I'm just a infrastructure engineer/architect as many of us here looking for VMware alternatives.
                  I work in big global company that builds and deploys solutions for different clients.
                  Most of them are asking if there is a real enterprise solution that we can work with, aside from VMware.
                  That's why I'm here trying to figure it out, how this product works. How to do things that you normal do on daily basis in vCenter and ESXi's.

                  No one have to provide any answers here. I wonder for how long this product will survive then ?
                  I would like to remind you that VMware market share and popularity came from free ESXi, vCenter with 3 months trial with full features and easy access to get into product and get help on forums.

                  My frustration is coming from basic things that I am not able to do here.
                  It's not that I'm asking about some advanced features. We are talking about VM provisioning on the basic level.
                  Template creation and deploying VMs from that template with changes that needs to be done during deployment like hostname, IPs and Windows SIDs.

                  If it's too much to ask how to do it, fine. I will move to check out other hypervisors.

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

                    @Andrew7 XCP-ng has always been free to use, the same for Xen Orchestra (from source) you can look at my profile to find a link or read the documentation to deploy it yourself.

                    You've hijacked someone else's thread to ask your question because their question was similar to yours, I guess?

                    And you seem to have an arrogance about your inquiry of "it just works on this other product that we're fleeing from that would cost us as much as 300% more every year forever".

                    And on the same coin, other side you're saying you haven't the faintest reason why anyone would be upset with your tone, while asking for free help.

                    Support for a 3 host pack, is as cheap as $1000/year or $3000, with essentially unlimited and confidential access for a product which has a long tract record.

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

                      Hi @jkatz @Andrew7,

                      Cloudbase-init is currently the recommended method for personalizing Windows templates in XO. It supports multiple configuration plugins (hostname/credentials/licensing etc.), which are available from the linked page above.

                      For customizing deployed VMs, what I like to do is to prepare a "skeleton" cloud-init file and set it in XO Settings -> Cloud config. Then I can load this config at any time and fill in the details later for each batch of VM I want to deploy.

                      We do have a Packer repo for making master VM templates from @nathanael-h; it will prepare an XVA image ready for specialization using cloudbase-init. I'll try to work to publish that and provide some documentation next.

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

                      A 1 Reply Last reply Reply Quote 0
                      • A Offline
                        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 Offline
                              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 Offline
                                        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 Offline
                                          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
                                            • First post
                                              Last post