Guidance on automating server deployment

We are working on a server model, based on debian, running Virtualmin and a few docker containers. We are using hosts to proxy traffic from domain names to the docker containers. Each docker application uses specific directives.

We have automated the installation of Virtualmin, docker services, docker applications. What I need guidance on is the way to automate creation of the hosts in Virtualmin with specific directives.

One way could be to import a server template that suites a proxy-only host, with no database, no mail etc… simply website and SSL service. Then use Virtualmin cli to create those hosts based on this template, and then modify the directives for each host. This seems a bit complicated. My question is, are there better ways for this?

For example, can I create the hosts on a server, export the host settings, and re-import in the new Virtaulmin using the CLI and only change the domain name? This way we might not need the server template export / import etc…

I appreciate any guidance on this from those who have a wider view on possibilities with Virtualmin.

Good thinking—using CLI with a proxy-only template seems like your best bet. You can export a sample config and reimport with a new domain name, but some tweaking is still needed.