--- - name: "Install Apache via apt" apt: update_cache: yes state: present name: - apache2 - name: Upload site config to destination copy: src: apache-site.conf dest: /etc/apache2/sites-available/site.conf mode: 644 owner: root - name: Enable ssl module command: a2enmod ssl - name: Enable proxy module command: a2enmod proxy - name: Enable proxy_http module command: a2enmod proxy_http - name: Enable site command: a2ensite site.conf - name: Enable and restart Apache2 daemon service: name: apache2 state: restarted enabled: yes - name: Allow https port via ufw community.general.ufw: rule: allow port: https