This is for a product setup, so that's why I have chosen PHP. I have made a module that benefits from PHPs SSH connector and from there do the whole setup. It also uses Amazon AWS' API to create a server so in 1 command I can create a new instance that will automatically be booted up as web- or database server. It can also, with another command, create both and link them together.
I tried with Docker but this added too much overhead on the maintenance. The PHP solution is really nice because it's just a list of commands send to the server.