Domains/Subdomains - two different machines

I have written a guide on how to do this with certbot

Certbot supports a range of DNS providers so you should be able to automate this if your DNS provider is supported.

Andrei