This roles automates the deployment of Let's Encrypt certbot utility on Debian-based hosts. The role utilizes the Cloudflare plugin for Domain Control Validation (DCV).
- Automates the certificate renewal process on a Debian-based host.
- Supports Debian 11 and above.
- Uses Cloudflare's API for Domain Control Validation (DCV).
- Installs certificates into apache2 and nginx.
- Debian 11 or above.
- Cloudflare access (to generate API token).
The role performs the following actions:
- Installs
snapdpackage. - Installs
certbotsnap. - Installs
certbot-dns-cloudflareplugin. - Configures logrotate.
- Stores and saves Cloudflare API token.
- Generates certificates.
- Installs certificates for
apache2andnginx.
Clone the project into the roles directory of your Ansible Controller.
git clone https://github.com/twobyteblog/lets_linux.gitCreate a API token to allow certbot to use CloudFlare for DNS-based Domain Control Validation (DCV). For this to work, the domain your requesting a signed certificate for must be added to your Cloudflare account.
- Browse to Cloudflare's User API Tokens.
- Create a new Token using the Edit zone DNS template. Limit the token to only the domain(s) required.
- Document the API Token value.
Within your Ansible environment, add the following variables:
# Cloudflare API token created in the previous step.
cloudflare_api_token: "token"
# Location to save Cloudflare token.
cloudflare_api_token_location: "/root/.cloudflare_token"
# Domains. This will generate two separate certificates.
cert_domains:
- twobyte.blog
- twobyte.caCreate a playbook which runs this role. This role requires become privileges.
- hosts: all
roles:
- role: lets_linux
become: yes