Use this script as part of any installation script. I use it as part of my script for settting up a virtualhost for a domain/website on Apache
you need these additional flags
--non-interactive
--agree-tos
--register-unsafely-without-email
or--email ${SSL_EMAIL}