- name: Check Certificate Modify Dates stat: path: "{{ letsencrypt_certs_dir }}/{{ site_url }}.crt" register: stat_results - name: Get LetsEncrypt Certificates import_tasks: letsencrypt.yml when: (stat_results.stat.mtime is undefined or (ansible_date_time.epoch|int - stat_results.stat.mtime) > (90 * 60 * 60 * 24)) - name: Copy Apache config template: src: apache-site.conf dest: /etc/apache2/sites-available/{{ site_url }}.conf owner: root group: root mode: u=rw,g=r,o=r - name: Enable Apache Modules shell: a2enmod ssl rewrite notify: - Restart Apache - name: Enable Apache site shell: a2ensite {{ site_url }} notify: - Restart Apache