--- - name: Create 2px directory become: true file: path: "{{ dir_2px }}" owner: "{{ owner_2px }}" group: "{{ group_2px }}" state: directory mode: 0775 - name: Install mod_wsgi become: true apt: name: libapache2-mod-wsgi-py3 state: present update_cache: yes notify: Reload apache2 service - name: Activate modules become: true apache2_module: name: "{{ item }}" state: present with_items: - rewrite - ssl - wsgi notify: Reload apache2 service - name: Copy vHost conf become: true template: src: 2px.info.conf.j2 dest: /etc/apache2/sites-available/2px.info.conf notify: Reload apache2 service - name: Activate vHost become: true command: a2ensite 2px.info.conf register: result changed_when: "'already enabled' not in result.stdout" notify: Reload apache2 service