--- - name: Certificates | LetsEncrypt Certbot | Apache | Install package ansible.builtin.package: name: ['python3-certbot-apache'] state: present - name: Certificates | LetsEncrypt Certbot | Apache | Checking sites ansible.builtin.command: 'ls /etc/apache2/sites-enabled/' changed_when: false register: enabled_apache_sites check_mode: false - name: Certificates | LetsEncrypt Certbot | Apache | Deploying temporary apache site ansible.builtin.template: src: 'templates/etc/apache2/sites-enabled/le_dummy.conf.j2' dest: '/etc/apache2/sites-enabled/tmp_le_dummy.conf' owner: 'root' group: 'root' mode: 0644 register: tmp_site_enable when: enabled_apache_sites.stdout_lines | length == 0 - name: Certificates | LetsEncrypt Certbot | Apache | Reloading apache ansible.builtin.systemd: name: 'apache2.service' state: reloaded when: - enabled_apache_sites.stdout_lines | length == 0 - tmp_site_enable.changed