Is it possible to rebuild a droplet with new user data?

April 7, 2018 322 views
DigitalOcean Initial Server Setup Control Panels

I'm poking around with RancherOS and I'm building a "provision script" that I pass into the Droplet creation user data.
However, instead of destroying the Droplet every time I need to fix my script, I would like to know if there is a way to inject new user data in the rebuild process. This would prevent allowing a new IP address, and so on.

Thanks,

1 Answer

you could run your provision script on the host directly to test it out. For the most part it will ignore / pass over steps it has already completed. Keep in mind this is only best used for initial scripting and setup/debugging.

You may want to use something like Terraform to automate the creation/destruction of your droplet which can also load your user-data - https://www.terraform.io/docs/providers/do/index.html

  • Hi Jason,

    Thank you for your input. I cannot run the script on my host since it's cloud-init script and it contains RancherOS specific sections. I'm still a bit new to this but now that I automated my droplet creation/deletion, I can test more easily.

    But, it's still a shame that the subcommand doctl compute droplet-action rebuild doesn't allow the --user-data or --user-data-file flags like the create subcommand.

Have another answer? Share your knowledge.