Tested on Ubuntu 20.04.
sudo apt install python3-pip
sudo pip3 install certbot certbot-dns-cloudflare certbot-nginx
https://dash.cloudflare.com/profile/api-tokens
mkdir ~/.secrets
echo "dns_cloudflare_api_token = XYZ-TOKEN" > ~/.secrets/cloudflare.ini
sudo chmod 0700 .secrets
sudo chmod 0400 ~/.secrets/cloudflare.ini
sudo certbot --installer nginx --dns-cloudflare --dns-cloudflare-credentials /home/XYZ-USER/.secrets/cloudflare.ini --dns-cloudflare-propagation-seconds 30
sudo certbot renew --dry-run --dns-cloudflare-propagation-seconds 30
sudo su
crontab -e
0 0 1 */2 * /usr/local/bin/certbot renew --quiet --dns-cloudflare-propagation-seconds 30