35 lines
972 B
YAML
35 lines
972 B
YAML
---
|
|
- hosts: webserver
|
|
become: true
|
|
tasks:
|
|
- name: install web components
|
|
apt: name={{item}} state=present update_cache=yes
|
|
with_items:
|
|
- apache2
|
|
- libapache2-mod-wsgi-py3
|
|
- python-pip-whl
|
|
- python3-virtualenv
|
|
|
|
- name: ensure apache2 started
|
|
service: name=apache2 state=started enabled=yes
|
|
|
|
- name: ensure mod_wsgi enabled
|
|
apache2_module: state=present name=wsgi
|
|
notify: restart apache2
|
|
|
|
- name: copy demo app source
|
|
copy: src=demo/app/ dest=/var/www/demo mode=0755
|
|
notify: restart apache2
|
|
|
|
- name: copy apache virtual host config
|
|
copy: src=demo/demo.conf dest=/etc/apache2/sites-available mode=0755
|
|
notify: restart apache2
|
|
|
|
- name: setup python virtualenv
|
|
pip: requirements=/var/www/demo/requirements.txt virtualenv=/var/www/demo/.venv
|
|
notify: restart apache2
|
|
|
|
handlers:
|
|
- name: restart apache2
|
|
service: name=apache2 state=restarted
|