Cloud Init

Posted on Aug 1, 2020

Debugging cloud-init

Cloud init is powerful, but can be difficult to debug when things go wrong. As I always forget where these things are, here is a list of the two most basic debugging capabilities; logs and manually running a module

Look in the log files @ /var/log/cloud-init*log

If something is failing re-run that module and see if it fails again

cloud-init -d --name (module name, e.g. cc_xxx) --frequency always

NOTE: Get the module name from https://cloudinit.readthedocs.io/en/latest/topics/modules.html

If things are broken, examine the logs and see what is being executed, probably see something such as

2020-06-19 10:46:12,794 - util.py[DEBUG]: Read 1057 bytes from /var/lib/cloud/instance/cloud-config.txt
2020-06-19 10:46:12,794 - util.py[DEBUG]: Attempting to load yaml from string of length 1057 with allowed root types (<class 'dict'>,)

Have a look at this file (it is the rendered template for this instance).

Next… figure out why it is rendered incorrectly