Report this

What is the reason for this report?

Automating ServerPilot/DO sync on droplet creation

Posted on October 13, 2014

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!



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.

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:

Thanks a lot guys!

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.

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.