--- - block: - name: Enable the proxy modules needed by letsencrypt apache2_module: name={{ item }} state=present notify: apache2 reload with_items: '{{ apache_letsencrypt_proxy_modules }}' - name: Install the letsencrypt conf template: src=letsencrypt-proxy.conf.j2 dest=/etc/apache2/conf-available/letsencrypt-proxy.conf owner=root group=root mode=0644 notify: apache2 reload - name: Enable the letsencrypt conf file: src=/etc/apache2/conf-available/letsencrypt-proxy.conf dest=/etc/apache2/conf-enabled/letsencrypt-proxy.conf state=link notify: apache2 reload - name: Create the acme hooks directory if it does not yet exist file: dest={{ letsencrypt_acme_services_scripts_dir }} state=directory owner=root group=root - name: Install a letsencrypt hook for apache copy: src=apache-letsencrypt-acme.sh dest={{ letsencrypt_acme_services_scripts_dir }}/apache2 owner=root group=root mode=4555 when: letsencrypt_acme_install is defined and letsencrypt_acme_install tags: [ 'apache', 'letsencrypt' ] - block: - name: Disable the letsencrypt conf file: dest=/etc/apache2/conf-enabled/letsencrypt-proxy.conf state=absent notify: apache2 reload - name: Remove the letsencrypt hook for apache file: path={{ letsencrypt_acme_services_scripts_dir }}/apache2 state=absent when: ( letsencrypt_acme_install is defined ) and ( not letsencrypt_acme_install ) tags: [ 'apache', 'apache_mods', 'letsencrypt' ]