I was able to find the reason XO is not working with cloud-init.
XO attaches iso with the cloud-config data as additional disk xvdb and it does not work.
But if you provide it as a cd? It will.
That is why - as for now you will need to create your own iso and attach it as a cd-rom.
You do that this way:
Get your files ready (meta-data network-config user-data). My examples below:
metadata:
instance-id: local-nocloud
local-hostname: myhost.example.com
network-config:
network:
version: 1
config:
- type: physical
name: eth0
subnets:
- type: static
address: 10.0.0.5/24
gateway: 10.0.0.254
- type: nameserver
address:
- 8.8.8.8
- 8.8.4.4
search:
- example.com
- type: physical
name: eth1
subnets:
- type: static
address: 192.168.0.5/24
user-data:
#cloud-config
### RUN CMD
runcmd:
- /usr/bin/apt -y install mc
- /usr/bin/date >> /root/testfile
# set system default user
system_info:
default_user:
name: testuser
gecos: Default Cloud User
# password auth - comment out if not using passwords
password: testpassword
ssh_pwauth: true
chpasswd: { expire: false }
# do some package management
#package_update: true
packages:
- iptraf
- mtr
- screen
- net-tools
- atop
Generate iso
genisoimage -output myiso.iso -volid cidata -joliet -rock user-data meta-data network-config
Upload iso to XO
home -> storage -> iso's -> disks -> new disk
Prepare VM/template
- Install Debian 10.6 with xo-tools
- install cloud-init and cloud-initramfs-growroot
- remove all network configuration leave just "allow-hotplug ethxxx"
(network config will be added in /etc/network/interfaces/50-cloud-init. It will not overwrite yours)
- shutdown the machine and create the template if you want or just restart VM.
- DO NOT LET IT BOOT! - keep it in grub.
- attach your iso
- let it run
It will do whatever you need on the machine.