VMware Cloud Community
SwanseaUni
Enthusiast
Enthusiast

Cloud-init config not running on deployment

Hi

I am new to VRA so bear with me, I have an ubuntu 20.4 template configued following this blog (vSphere Customization with Cloud-init While Using vRealize Automation 8 or Cloud. – VMwareLab) when we deploy this via vr8.4 the machine doesnt run the stuff under the cloudconfig section of the blueprint

The ubuntu template is set to OVF for the datastore, the  BP is below

formatVersion: 1
inputs:
vmname:
type: string
description: vmname
title: Server Name
minLength: 6
maxLength: 15
format: ''
size:
type: string
description: The machine size
title: Size of VM
default: Small
enum:
- Small
- Medium
- Large
resources:
Cloud_Network_1:
type: Cloud.Network
properties:
networkType: existing
name: Vmachines_23
Cloud_Machine_1:
type: Cloud.Machine
properties:
name: '${input.vmname}'
image: Ubuntu v20 v2
flavor: '${input.size}'
networks:
- network: '${resource.Cloud_Network_1.id}'
assignment: static
attachedDisks:
- source: '${resource.Cloud_Volume_1.id}'
folderName: Ubuntu
#customizeGuestOs: false
#cloud-config
cloudConfig: |
package_update: true
package_upgrade: true
runcmd:
- touch /home/cloudadmin/configapplied.complete
- echo "Cloud Init Completed"
Cloud_Volume_1:
type: Cloud.Volume
properties:
capacityGb: 1

after the machine deploys i can see the iso is mounted and if i look at the xml file and base64 decript the string then it has the contents of the cloudconfig section of the blueprint. But the runcmd file never runs and doesnt appear in 

/var/lib/cloud/instances/iid-datasource-none *which apparently it should ?)

the cloud-init.log file contains the following lines which looks like its not gettting the data from the OVA ?

2022-02-09 15:23:57,213 - helpers.py[DEBUG]: Running config-runcmd using lock (<FileLock using file '/var/lib/cloud/instances/iid-datasource-none/sem/config_runcmd'>)
2022-02-09 15:23:57,213 - cc_runcmd.py[DEBUG]: Skipping module named runcmd, no 'runcmd' key in configuration
2022-02-09 15:23:57,213 - handlers.py[DEBUG]: finish: modules-config/config-runcmd: SUCCESS: config-runcmd ran successfully

im completely stuck at this point so any pointers would be gratefully recieved !

Thaks in advance

 

Reply
0 Kudos
3 Replies
carl1
Expert
Expert

I would double check your indentation (2 spaces for each level, no tabs).  Your commands should go into a script file but cloud-init seems to be seeing it as a directive.

Carl L.

Reply
0 Kudos
SwanseaUni
Enthusiast
Enthusiast

i have fixed it ! 

the indentations are right Carl, the issue was that even though i reconfigured cloud-init  with the

dkpg-reconfigure cloud-init 

command to select OVA, a file called 99-installer.cfg existed under /etc/cloud/cloud.cfg.d and that had datastore - none set so it was overiding everything ! 

All seems to be working now, although as a newbie to vra the documentation misses our key bits all over the place ! 

Thanks For the repsonse though 

Reply
0 Kudos
nicolastobias
Contributor
Contributor

Woul you tell what you added?

Reply
0 Kudos