--- - name: 'apache2 | update ports' replace: path: /etc/apache2/ports.conf regexp: '^Listen 80' replace: "Listen {{ apache2_listen_ip }}:{{ apache2_listen_port }}" backup: yes notify: - apache2 restart tags: - apache2 - apache2_configure - name: 'apache2 | configuration | defaults modules' community.general.apache2_module: name: "{{ item.module }}" state: "{{ item.state }}" ignore_configcheck: true loop: - module: headers state: present - module: rewrite state: present - module: proxy state: present - module: proxy_fcgi state: present - module: proxy_http state: present notify: - apache2 restart tags: - apache2 - apache2_configure - name: 'apache2 | configuration | create ACME directory' file: path: /var/www/letsencrypt/.well-known/acme-challenge/ state: directory owner: www-data group: www-data mode: '0755' tags: - apache2 - apache2_configure - name: 'apache2 | configuration | push ACME configuration' copy: src: 'acme.conf' dest: /etc/apache2/conf-enabled owner: root mode: 644 notify: - apache2 restart tags: - apache2 - apache2_configure