How to edit and re-run Cloud-Config user data?
I'm debugging a Cloud-Config user data script. It'd be nice to make changes and re-run, without rebooting, if that's possible?
Here's me doing it wrong:
#cloud-config runcmd: - date >> /var/log/runcmd.log
After the instance boots,
Running module runcmd [...] finish: modules-config/config-runcmd: SUCCESS: config-runcmd ran successfully
runcmd.log has one entry -- so far, so good. Goal #1 is to add a second entry.
cloud-init init seems to only run vendor data. The internet says to first run
cloud-init clean. This seems to delete my user data.
cloud-init single --name runcmd --frequency always writes the script out, but never runs it:
Cloud-init v. 19.1-1-gbaa47854-0ubuntu1~18.04.1 running 'single' [...] Writing to /var/lib/cloud/instances/152272562/scripts/runcmd - wb:  38 bytes Reading from /proc/uptime (quiet=False) Read 14 bytes from /proc/uptime cloud-init mode 'single' took 0.198 seconds (0.20)
I beleive the semaphore file is ignored ignored with
--frequency always. Removing the semaphore file didn't help.
If I reach goal #1, the second is to edit the user data -- will Cloud-Config read from
/var/lib/cloud/instance/user-data.txt, or is this just an artifact?