--- - name: install Gunicorn with dedicated pip virtualenv pip: name: - gunicorn state: "{% if hcs_update | bool %}latest{% else %}present{% endif %}" virtualenv: "{{ modoboa_py_venv }}" - name: setup required logging folder file: state: directory path: "{{ prefix }}/gunicorn" loop: - /var/log - /var/run loop_control: loop_var: prefix label: "{{ prefix }}/gunicorn" - name: setup gunicorn modoboa config template: src: app/modoboa/instance/gunicorn.conf.py.j2 dest: "{{ modoboa_instance_folder }}/{{ modoboa_instance }}/gunicorn.conf.py" mode: 0740 group: www-data notify: reload gunicorn - name: setup gunicorn service unit template: src: etc/systemd/system/gunicorn.service.j2 dest: /etc/systemd/system/gunicorn.service mode: 0755 notify: reload gunicorn - name: enable gunicorn systemd unit systemd: name: gunicorn enabled: yes daemon_reload: yes state: started