Question

Automating ServerPilot/DO sync on droplet creation

I’d like to automatically run these steps when a new droplet is created:

  1. Since there is no way to send an email containing droplet password if created with an SSH key ( which should be allowed guys ), have the new droplet’s password reset ( current workaround for password on droplets w/ ssh keys ), and send that password to another email. Thus allowing myself to have access via ssh, and the client via password until they add their ssh key in later into authorized_hosts.
  2. Create a new server on ServerPilot.
  3. Run the install script given by ServerPilot on the new DO droplet.

Is this possible and how would i be able to accomplish this, say, with your api?

I would also need to work with serverpilots api as well correct?

Perhaps use the two together to create a dashboard of some sorts?

Thanks ahead of time!


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.

We just released a new feature that sounds like it might help with this use case. Our metadata service allows you to provide “user-data” when you create a new droplet. This data can then be used to allow you to configure the server on first boot. It will run bash scripts or cloud-config files.

Using a cloud-config file, you could run the ServerPilot script automatically on first boot and set a root password. It would look something like:

#cloud-config
runcmd:
  - echo "You can run arbitrary commands"
chpasswd:
  list: |
    root:foobarbaz
  expire: True

This would set a root password that had to be changed on first login.

Of course there is a lot more you can do with this, create new users, add ssh keys, etc… For more information, check out these tutorials:

Hello guys, I have been trying to achieve this in PHP but failed so far :( any help would be welcome, I need to connect my droplet when I create it with DO API … Thanks in advance for taking the time to help.

Thanks a lot guys!