Open Ikariusrb opened 1 month ago
@Ikariusrb,
proxmox_cloud_init_disk
only supports cdrom
and not cloudinit
in disk blocks.To get proxmox_cloud_init_disk
to work you have options:
Use only proxmox_cloud_init_disk
functionality, without cloudinit
disk block, don't define ciuser
, cipassword
, cicustom
etc.
Define all these parameters in proxmox_cloud_init_disk
for example in user_data
file.
proxmox_cloud_init_disk
uses NoCloud datasource and configured as method1:
Method 1: Labeled filesystem A labeled vfat or iso9660 filesystem may be used. The filesystem volume must be labelled CIDATA.
So, this means that no additional modifications or settings are required for it to work.
proxmox_cloud_init_disk
(NoCloud) datasource with cloudinit
(Config drive) with datasource_list
parameter:
https://cloudinit.readthedocs.io/en/latest/reference/base_config_reference.html#base-config-datasource-listAlso, I think this is the wrong approach for user_data
:
...
user_data = yamlencode({
hostname = local.vm_name
fqdn = "${local.vm_name}.${local.local_domain}"
manage_etc_hosts = true
users = ["default"]
user = local.cloudinit_user
ssh_authorized_keys = [local.ssh_key]
package_upgrade = true
chpasswd = {
expire = false
}
})
...
You should use here Heredoc Strings, like:
...
user_data = <<-EOT
#cloud-config
users:
- default
ssh_authorized_keys:
- ssh-rsa AAAAB3N......
EOT
...
Because user_data
must begin with #cloud-config
.
https://cloudinit.readthedocs.io/en/latest/explanation/format.html
I'm currently fighting with 3.0.1-rc2 and trying to convince it to use a custom-generated
proxmox_cloud_init_disk
. I'm able to get it to generate a cloud init iso image on the proxmox node without too much difficulty:I can verify it's successfully generating an ISO on the proxmox node with this resource, and I've temp mounted that
.iso
and validated its contents look correct. I've got a couple of templates; one with a cloudinit device as a cdrom on ide2, and one without.The trouble comes in when I attempt to actually use that iso for cloudinit. I can get ide2 as a cdrom with the iso attached, but I can't seem to get it to recognize it as a cloudinit source. I suspect I'm missing something in my disks config. Here's where I'm at currently for the VM disk config:
I haven't found a combination of config that lets me specify a cloudinit drive AND the ISO image. The only parameter the
cloudinit
block seems to support is thestorage
, which only tells it which storage pool to use.I've followed as much as I could in the docs and read a number of the bugs, but most of the examples are for using the proxmox built-in cloud-init config, and I want to add some things which aren't supported through proxmox' cloudinit config (packages, runcmd).