Cloudbase-init on Windows
-
-
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.
-
@jkatz Do the issues occur even if the template was prepared from audit mode?
-
@dinhngtu
Still nothing. I've tried use only :
#cloudbase-config
hostname: VMNameI 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.
-
By the way, how to edit Template ?
-
Didn't bother with manual sysprep anymore. I just let the installer start it.
-
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.
-
@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
It worked
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...
-
I ran into the same issue when trying to configure a network adapter with cloudbase-init. The documentation says that the MAC address value is optional but in reality it is required.
In my case I want Xen Orchestra to choose a unique MAC during deployment, and I since I am deploying from a template, the NIC name is a known value. The fix that ended up working for me was to modify the networkconfig.py file in cloudbase-init so that the NIC name is required and the MAC address is optional.
I ended up making some additional changes to allow for the network-config v2 format along with the existing v1 support and some additional logic to aid in setting the dns search domains (I can't recall if this was originally supported or not but I had issues getting it to work with the original networkconfig.py file)
This file needs to replace the existing one that is installed in the C:\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\Lib\site-packages\cloudbaseinit\plugins\common\ directory. To replace it you should make sure that the cloudbase-init service is stopped, then replace the file.
Once this file is replaced, delete the pycache folder in the same parent folder as networkconfig.py - this will ensure that python recompiles this file on service start. Start the cloudbase-init service and confirm that you see a new pycache get created.
I'm not a python programmer by trade so others may be able to point out areas for improvement but this ended up working for me and I wanted to share in case it could help others needing to deploy new servers without manually specifying a new MAC address. Below is an example network-config v2 format that works with the updated file.
version: 2
ethernets:
Ethernet 2:
dhcp4: false
addresses:
- 10.20.30.10/24
nameservers:
addresses:
- 10.20.5.12
- 10.20.5.13
- 10.20.5.14
search:
- intranet.domain.org
- domain.org
- public-domain.org
routes:
- to: default
via: 10.20.30.1Updated networkconfig.py file:
networkconfig.py.txt -
@tmk said in Cloudbase-init on Windows:
I ran into the same issue when trying to configure a network adapter with cloudbase-init. The documentation says that the MAC address value is optional but in reality it is required.
In my case I want Xen Orchestra to choose a unique MAC during deployment, and I since I am deploying from a template, the NIC name is a known value. The fix that ended up working for me was to modify the networkconfig.py file in cloudbase-init so that the NIC name is required and the MAC address is optional.
I ended up making some additional changes to allow for the network-config v2 format along with the existing v1 support and some additional logic to aid in setting the dns search domains (I can't recall if this was originally supported or not but I had issues getting it to work with the original networkconfig.py file)
This file needs to replace the existing one that is installed in the C:\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\Lib\site-packages\cloudbaseinit\plugins\common\ directory. To replace it you should make sure that the cloudbase-init service is stopped, then replace the file.
Once this file is replaced, delete the pycache folder in the same parent folder as networkconfig.py - this will ensure that python recompiles this file on service start. Start the cloudbase-init service and confirm that you see a new pycache get created.
I'm not a python programmer by trade so others may be able to point out areas for improvement but this ended up working for me and I wanted to share in case it could help others needing to deploy new servers without manually specifying a new MAC address. Below is an example network-config v2 format that works with the updated file.
version: 2
ethernets:
Ethernet 2:
dhcp4: false
addresses:
- 10.20.30.10/24
nameservers:
addresses:
- 10.20.5.12
- 10.20.5.13
- 10.20.5.14
search:
- intranet.domain.org
- domain.org
- public-domain.org
routes:
- to: default
via: 10.20.30.1Updated networkconfig.py file:
networkconfig.py.txtThank you for posting! I followed your directions verbatim and I'm still having trouble getting the network config to take. Does it work with Windows Server 2025?