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?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.
Click below to sign up and get $100 of credit to try our products over 60 days!