This is how I install Certbot in a Bash script:
apt-get update -y && add-apt-repository ppa:certbot/certbot -y && apt-get update -y
apt-get upgrade nginx python-certbot-nginx -y
That's the playbook syntax I found to install Nginx in default conf:
- hosts: localhost
connection: local
become: true
tasks:
- name: install nginx
apt: pkg=nginx state=installed update_cache=true
Is there no Ansible task to install Certbot as well, instead the above "heavier" Bash code?