You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

54 lines
1.2 KiB

---
- name: install packages
apk:
name:
- lighttpd
- py3-flask
- py3-gunicorn
state: installed
- vars:
web_user: lighttpd
web_group: lighttpd
docroot: /var/www/localhost/htdocs
flask_entry: app.py
lighttpd_conf: /etc/lighttpd/lighttpd.conf
proxy_port: 3031
block:
- name: add mod_proxy.conf include to lighttpd.conf
lineinfile:
path: "{{ lighttpd_conf }}"
line: 'include "mod_proxy.conf"'
insertafter: "{{ '# {{{ includes' }}"
- name: copy mod_proxy.conf template
template:
src: templates/mod_proxy.conf.j2
dest: /etc/lighttpd/mod_proxy.conf
- name: copy dummy app template
template:
src: "templates/{{ flask_entry }}.j2"
dest: "{{ docroot }}/{{ flask_entry }}"
mode: 0644
owner: "{{ web_user }}"
group: "{{ web_group }}"
- name: copy gunicorn-flask openrc init script
template:
src: "templates/flask_init.j2"
dest: "/etc/init.d/flask"
mode: 0755
- name: start and enable custom flask service
service:
name: flask
enabled: yes
state: restarted
- name: start and enable lighttpd service
service:
name: lighttpd
enabled: yes
state: restarted