Search code examples
cloud-init

How to validate a custom data file with cloud-init


I am using custom-data to pass in some boot time configuration to a server on azure. I can see the file at the location

/var/lib/cloud/instances/<instance_id>/user-data.txt

and cloud-init is showing as done (cloud-init status)

the problem is that none of the script is doing anything, and there are no config files produced.

I was wondering if anyone knew of a command to show if the file at the location above is valid syntactically?

thanks


Solution

  • I was wondering if anyone knew of a command to show if the file at the location above is valid syntactically?

    To validate the config, check out the cloud-init schema subcommand. Something like this may be what you want:

    On a live system:

    cloud-init schema --system
    

    To see the userdata passed, try:

    cloud-init query userdata
    

    To see everything passed, try:

    cloud-init query --all