cloudinit custom conf not taken in account

warmup031

Member
May 23, 2020
7
1
23
44
Hello,
I'm trying to configure cloud-init to set a vm template with initial configuration from cloudinit file but don't manage to add custom conf to my vm :

I followed https://pve.proxmox.com/wiki/Cloud-Init_Support
and used the command
qm set 101 --cicustom "user=local:snippets/user_data.yaml
file OK and present in /var/lib/vz/snippets/user_data.yaml

reboot vm, but modification not taken in account.
The only one which is working is the one from proxmox GUi, where I can set a user, ssh pub key ...

proxmox version 8.2.2

cat /etc/pve/storage.cfg
dir: local
path /var/lib/vz
content rootdir,images,snippets,iso,vztmpl,backup
shared 0

lvmthin: local-lvm
thinpool data
vgname pve
content rootdir,images

what am I missing ?
Thank you for your help

Olivier
 
The following information might be helpful:
a) what image are you using
b) what is the context of user_data file
c) what is the full configuration of the VM
d) what troubleshooting , if any, have you done after VM boots? Logs? CD state?

We use custom init daily, it works without issues. Are you trying with fresh image or just rebooting something that has already been configured? Keep in mind, that some portions of CloudInit are only executed once.


Blockbridge : Ultra low latency all-NVME shared storage for Proxmox - https://www.blockbridge.com/proxmox
 
The following information might be helpful:
a) what image are you using
b) what is the context of user_data file
c) what is the full configuration of the VM
d) what troubleshooting , if any, have you done after VM boots? Logs? CD state?

We use custom init daily, it works without issues. Are you trying with fresh image or just rebooting something that has already been configured? Keep in mind, that some portions of CloudInit are only executed once.


Blockbridge : Ultra low latency all-NVME shared storage for Proxmox - https://www.blockbridge.com/proxmox
Abiword HTML Document
Hello,

I discovered cloudinit yesterday, so I’m really newbie with it.

I'm using the image fromhttps://cloud.debian.org/images/cloud/bookworm/latest/debian-12-generic-amd64.qcow2 to create a template, and adding cloudinit custom configuration

About troubleshooting, I just boot the vm, log with account created with proxmox cloudinit vm Gui, check the user I want to create via user_data.yaml, and saw
if it is present or not )

What do you mean as «context» ? The user_data.yaml file ?



users:

- name: John

groups: sudo

shell: /bin/bash

sudo: ['ALL=(ALL) NOPASSWD:ALL']

passwd:$6$j212wezy$7H/1LT4f9/N3wpgNunhsIqtMj62OKiS3nyNwuizouQc3u7MbYCarYeAHWYPYb2FT.lbioDm2RrkJPb9BZMN1O/



vm configuration :

cat /etc/pve/nodes/pxm1/qemu-server/101.conf

bootdisk: scsi0

cicustom: user=local:snippets/user_data.yaml

cipassword: $5$eq/FwxbT$EbKqL/KtQhWiLKJGsRtGPVWvvvIpIf3tKRW70v0/4.1

ciuser: admin

cores: 2

cpu: host

ide2: local:666/vm-666-cloudinit.qcow2,media=cdrom

ipconfig0: ip=dhcp

memory: 4096

meta: creation-qemu=8.1.5,ctime=1723218295

name: debian12-cloudinit

net0: virtio=BC:24:11:A3:E7:C8,bridge=vmbr0

scsi0: local-lvm:vm-666-disk-0,backup=0,iothread=1,size=20G

scsihw: virtio-scsi-single

serial0: socket

smbios1: uuid=69307e1d-4b4f-4bc8-b833-d6c230a07809

vga: serial0

vmgenid: af84b538-a68e-427f-8c5e-856436ae9979


How do I know which portion of cloudinit conf has already been executed, or not ?
Thank you
 
Few things:
a) PVE built-in CloudInit is mutually exclusive with CICUSTOM. If you use cicustom user= , then the PVE one will not be applied.
b) For new cloudinit settings to take effect you need to completely power-off the VM, or manually regenerate CloudInit
c) Since you did not use "CODE" tags when posting, its impossible to say whether you YML file is correct. I recommend using https://www.yamllint.com/ to validate your syntax
d) To learn which module applies to first or every boot, you should reference the documentation: https://cloudinit.readthedocs.io/en/latest/reference/modules.html
example:
Code:
Internal name: cc_ansible

Module frequency: once-per-instance <<<<<<<<<<<<<<<<

Supported distros: all

Activate only on keys: ansible



Blockbridge : Ultra low latency all-NVME shared storage for Proxmox - https://www.blockbridge.com/proxmox
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!