4 changed files with 0 additions and 80 deletions
@ -1,54 +0,0 @@
|
||||
--- |
||||
- 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 |
||||
@ -1,9 +0,0 @@
|
||||
|
||||
from flask import Flask |
||||
app = Flask(__name__) |
||||
|
||||
@app.route("/{{ ansible_facts['hostname'] }}") |
||||
@app.route("/{{ ansible_facts['hostname'] }}/") |
||||
def hello_world(): |
||||
return 'Hello World!' |
||||
|
||||
@ -1,8 +0,0 @@
|
||||
#!/sbin/openrc-run |
||||
|
||||
command="/usr/bin/gunicorn" |
||||
pidfile="/run/${RC_SVCNAME}.pid" |
||||
command_args="-w 4 -b 127.0.0.1:{{ proxy_port }} --chdir {{ docroot }} \ |
||||
-u {{ web_user }} -g {{ web_group }} app:app" |
||||
command_args_background="--daemon -p ${pidfile}" |
||||
|
||||
Loading…
Reference in new issue