--- - name: Create 2px directory become: true ansible.builtin.file: path: "{{ document_root }}" owner: "{{ apache2_owner }}" group: "{{ apache2_group }}" state: directory mode: 0775 - name: Install mod_wsgi become: true ansible.builtin.apt: name: libapache2-mod-wsgi-py3 state: present update_cache: true notify: Reload apache2 service - name: Enable wsgi module become: true community.general.apache2_module: name: wsgi state: present notify: Reload apache2 service - name: Copy vHost conf become: true ansible.builtin.template: src: apache2/2px.info.conf.j2 dest: /etc/apache2/sites-available/2px.info.conf mode: 0644 notify: Reload apache2 service - name: Activate vHost become: true ansible.builtin.command: a2ensite 2px.info.conf register: result changed_when: "'already enabled' not in result.stdout" notify: Reload apache2 service