--- - name: Install Certbot and Apache plugin ansible.builtin.apt: name: - certbot - python3-certbot-apache state: present - name: Ensure Apache is running and enabled ansible.builtin.service: name: apache2 state: started enabled: true - name: Obtain Let's Encrypt certificate using certbot ansible.builtin.command: > certbot --apache -n --agree-tos --redirect -d {{ httpd_site_name }} --email {{ admin_email }} {{ httpd_tls_certbot_additonal_args }} args: creates: "/etc/letsencrypt/live/{{ httpd_site_name }}/fullchain.pem"