Custom config / cloud-init
-
@bvitnik said in Custom config / cloud-init:
https://docs.xcp-ng.org/guides/create-use-custom-xcpng-ubuntu-templates/
I noticed in the documentation, they put "password:" for user password creation.
what is working for me :
plain_text_passwd: 'myverysecureplaintextpassword'more secure, use a SHA 512 encrypted password, but with :
passwd: QChUQYy14yOv_encrypted_password_mgnEFL6TRPIsJ/4make it encrypted with
# mkpasswd --method=SHA-512 -
@Pilow
password:as a global option andpasswd:orplain_text_passwd:underusers:key are two different things. The first one sets the password for the default user,ubuntuon Ubuntu if I recall correctly, while the others set password for the user specified in theusers:key.Read the docs people

-
@bvitnik indeed, RTFM
i'm a newb on cloud-init, and should follow more this good advice !
-
So I have had some more time to play around with this, and I think I got it working except for one part.
After I convert the vm to a template and go deploy new vm with newly created template. Even if i put in the network config as such.
#cloud-config network: version: 2 ethernets: enX0: dhcp4: true dhcp6: false set-name: "enX0"The new vm does not get IP address. When i log into new vm it does not have /etc/netplan/50-cloud-init.yaml with the above network config.
If i manually create the file with the above config and reboot the vm gets an IP address and a different one then previous vm
-
@acebmxer Did you do:
cloud-init clean --logs --seedbefore converting the VM to template?
Also, network configuration is not part of the
cloud-config(aka user data). In XO, there is a separate field called "Network config" where it should be specified. See examples at the end of the guide I pasted earlier.network:key should also be removed (commented in the examples). -
@bvitnik
This is creating new vm from Hub template. If i try the below network config the VM hangs on boot. Think previously it would eventually boot but have not networking as stated previously.#cloud-config # network: version: 2 ethernets: enX0: dhcp4: true dhcp6: false set-name: "enX0"This is copy pasted from the link you provided about additional infomation to add to documentation. does not show network: commented out. When i use this with ips corrected to my network the vm boots fast but again still no networking. Even if i comment out network. Still no networking. I have to leave blank during vm creation. Can you past your working network config?
#cloud-config network: version: 2 ethernets: eth0: dhcp4: false addresses: - 10.0.2.6/27 gateway4: 10.0.2.1 nameservers: addresses: - 10.0.2.1 - 1.1.1.1EDIT -
This is a working config for new vm from Ubuntu Hub template. VM boots and gets IP address. Its not much different then my original. I dont know. Still learning this stuff.
network: version: 2 ethernets: enX0: # or whatever your interface name is dhcp4: trueEdit -2 while the above works for dhcp the below does not work for static. VM does not get static ip
network: version: 2 ethernets: enX0: # or whatever your interface name is dhcp4: false addresses: - 10.100.10.206/24 gateway4: 10.100.10.254 nameservers: addresses: - 10.100.10.254 - 1.1.1.1 -
@bvitnik said in Custom config / cloud-init:
@acebmxer Did you do:
cloud-init clean --logs --seedbefore converting the VM to template?
Also, network configuration is not part of the
cloud-config(aka user data). In XO, there is a separate field called "Network config" where it should be specified. See examples at the end of the guide I pasted earlier.network:key should also be removed (commented in the examples).besides getting it working on fresh vm from the ubuntu template from the Hub. I do have that command in script to prepare the vm to create a template from it. AI says this will cause the vm not to recreate the 50-cloud-init.yaml file. So how do I work around that also.
-
@acebmxer said in Custom config / cloud-init:
...
network: version: 2 ethernets: enX0: # or whatever your interface name is dhcp4: false addresses: - 10.100.10.206/24 gateway4: 10.100.10.254 nameservers: addresses: - 10.100.10.254 - 1.1.1.1Address should be on the next line:
addresses: - 10.100.10.206/24Regarding
50-cloud-init.yaml, AI is lying
. -
@bvitnik
that worked. -
@acebmxer Great. These are some YAML basics. You should read more about it
. Following AI instructions without understanding is not going to take you far.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login