Should be #cloud-config file be run after the first creation or only after the first reboot? (RancherOS)

I’m using terraform to buld the server, and it does work correctly after the first reboot, but after creation it doesn’t work. What the script is trying to do is to start a rancher service. LIke I said if I reboot the server the rancher service comes up perfectly, but it isn’t coming up after the box is first created.

Submit an answer

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!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

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.

This comment has been deleted

The cloud-config file should be run on first boot. Though with RancherOS, there is an important caveat that can sometimes catch people up. From the Rancher docs:

When using runcmd, RancherOS will wait for all commands to complete before starting Docker. As a result, any docker run command should not be placed under runcmd. Instead, the /etc/rc.local script can be used. RancherOS will not wait for commands in this script to complete, so you can use the wait-for-docker command to ensure that the Docker daemon is running before performing any docker run commands.

So if the service depends on Docker, it’s possible that it’s not available yet. Though as it comes up after a reboot, there could be another issue here. Could you share your actual script or an example demonstrating the same behavior? It would help narrow down the problem.