Ansible’s AWS ACM module didn’t, at time of writing, support generating new certificates. ACM certificates can be programatically generated and verified (using DNS) with a bit of glue and sticky tape. This assumes that the Route53 zone for your domain is in your AWS account (or you can somehow grant permission to add records to it in another account).
Here’s the Playbook on GitHub: https://github.com/phil-lavin/ansible-aws-acm-generate-certificate
It’s mostly ready for use but might require some minor tweaks for your usecase. It’s designed to be stateless so if a certificate exists or Ansible bailed out half way through the play, it’ll retrieve the state from ACM and carry on.
The procedure is thus:
- Try to get the ISSUED certificate, if one exists
- Try to get the PENDING_VALIDATION certificate, if one exists
- Request a new certificate if we don’t have one at all
- Wait for certificate DNS record to be made available
- Create Route53 DNS record for the certificate
- Wait for certificate to be validated
Feel free to submit a GitHub Pull Request if you have some enhancements/bug fixes.