VMware Cloud Community
V00Z11
Enthusiast
Enthusiast
Jump to solution

vRA 8.10 Ubuntu 22 template with cloud-init fails sometimes with: Used fallback datasource

I’m in the process of creating new VM templates for vRA. These include Ubuntu 22, Rocky 9 und SLES 15 SP4. All templates are configured the same, including EFI, Secure Boot, Passthrough CD drive, CPU, Memory and Disk config.

With the Rocky 9 and SLES 15 templates I don’t have any problems. Every deployment is working just fine and the machines are customized with Cloud-init. The customizations include changing the root password, setting static IPs and changing the hostname.

Ubuntu 22 on the other hand is driving me nuts. For some deployments, the Cloud-init customization is working just fine, for other deployments, Cloud-init cannot get the cloudConfig from the OVF datasource (ISO) and just exists with the warning “Used fallback datasource”. Even though the ISO is attached and I can even read the content with “cat /dev/sr0”.

This is even happening when I start a deployment where multiple machines are deployed at the same time. Just now I deployed 3 machines and for 2 of them Cloud-init worked, but 1 failed.

This tells me that the VM template, the vRA cloud template and the Cloud Config should be fine. But I don’t have a clue why it fails every other time.

Did anybody else run into the same issue?

 

Failed cloud-init:

failed_cloud-init.png

 

Successful cloud-init:

successful_cloud-init.png

Both of the above deployments are from the same deployment, with the same template, cloud config and so on.

 

0 Kudos
1 Solution

Accepted Solutions
V00Z11
Enthusiast
Enthusiast
Jump to solution

Thanks for responding! Your idea and https://kb.vmware.com/s/article/90331 pointed me in the right direction and I got it fixed. Scenario 1 is the solution that worked for me. 

/etc/cloud/cloud.cfg

disable_root: false
ssh_pwauth: true
# disable_vmware_customization: false # should not be set
no_ssh_fingerprints: true
network:
  config: disabled


/etc/cloud/cloud.cfg.d/90_dpkg.cfg

datasource_list: [ OVF, VMware ]


/etc/systemd/system/cloud-init.target.wants/cloud-init.service


[Unit]
(...)
After=dbus.service


/lib/systemd/system/open-vm-tools.service


[Unit]
(...)
After=dbus.service


/etc/netplan/00-installer-config.yaml

network:
  ethernets:
    ens192: # or ens160
      optional: true
      dhcp4: true
      dhcp-identifier: mac
  version: 2


/etc/netplan/50-cloud-init.yaml delete


cloud-init clean --logs --seed
 
 
Cloud Template
 
customizeGuestOs: true
cloudConfig: |
    #cloud-config
    ssh_pwauth: true
    chpasswd:
        expire: false
        users:
        - name: root
            password: '${input.password}'
            type: text
    users:
        - name: root
            ssh_authorized_keys:
            - '${input.sshkey}'
    runcmd:
        - hostnamectl set-hostname ${self.resourceName}
        - touch /etc/cloud/cloud-init.disabled
        - eject
 
 
 vSphere OS Customization will do the networking part automatically (even for static ip assignments). After that cloud init does it’s part.
 

View solution in original post

0 Kudos
3 Replies
ronaldod
Enthusiast
Enthusiast
Jump to solution

Why not inject the metadata by the vmware tools. Much more stable. (only in combination with cloud(base)-init.

 

 

 

 

V00Z11
Enthusiast
Enthusiast
Jump to solution

Thanks for responding! Your idea and https://kb.vmware.com/s/article/90331 pointed me in the right direction and I got it fixed. Scenario 1 is the solution that worked for me. 

/etc/cloud/cloud.cfg

disable_root: false
ssh_pwauth: true
# disable_vmware_customization: false # should not be set
no_ssh_fingerprints: true
network:
  config: disabled


/etc/cloud/cloud.cfg.d/90_dpkg.cfg

datasource_list: [ OVF, VMware ]


/etc/systemd/system/cloud-init.target.wants/cloud-init.service


[Unit]
(...)
After=dbus.service


/lib/systemd/system/open-vm-tools.service


[Unit]
(...)
After=dbus.service


/etc/netplan/00-installer-config.yaml

network:
  ethernets:
    ens192: # or ens160
      optional: true
      dhcp4: true
      dhcp-identifier: mac
  version: 2


/etc/netplan/50-cloud-init.yaml delete


cloud-init clean --logs --seed
 
 
Cloud Template
 
customizeGuestOs: true
cloudConfig: |
    #cloud-config
    ssh_pwauth: true
    chpasswd:
        expire: false
        users:
        - name: root
            password: '${input.password}'
            type: text
    users:
        - name: root
            ssh_authorized_keys:
            - '${input.sshkey}'
    runcmd:
        - hostnamectl set-hostname ${self.resourceName}
        - touch /etc/cloud/cloud-init.disabled
        - eject
 
 
 vSphere OS Customization will do the networking part automatically (even for static ip assignments). After that cloud init does it’s part.
 
0 Kudos
ronaldod
Enthusiast
Enthusiast
Jump to solution

I push everything with cloud-init and no cd ovf needed or all kind of scripts.

Just create a second variable in your template and push it into the guestinfo.metadata.

Live just became so easy with this. Best thing it is pretty universal. Only you need the latest cloud-init that supports this option.

I used this based on this article https://blog.v12n.io/cloud-init-with-vrealize-automation-and-vsphere-no-cd-drive/