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.
81 lines
2.0 KiB
81 lines
2.0 KiB
--- |
|
- name: install packages |
|
apk: |
|
name: |
|
- build-base |
|
- git |
|
- jpeg-dev |
|
- lighttpd |
|
- python3-dev |
|
- py3-pip |
|
- py3-setuptools |
|
- py3-virtualenv |
|
- uwsgi |
|
- uwsgi-python3 |
|
- zlib-dev |
|
state: installed |
|
|
|
- vars: |
|
git_repo: "https://gitlab.com/cinnaboot/gallery.git" |
|
docroot: /var/www/localhost/htdocs |
|
folder: '{{ docroot }}/gallery' |
|
flask_entry: gallery |
|
web_user: lighttpd |
|
web_group: lighttpd |
|
proxy_port: 3031 |
|
block: |
|
- name: test if gallery is already installed |
|
find: |
|
paths: "{{ folder }}" |
|
pattern: README |
|
register: check_installed |
|
|
|
- set_fact: |
|
install_gallery: "{{ check_installed.matched == 0 }}" |
|
|
|
- name: install block |
|
when: install_gallery |
|
block: |
|
- name: add mod_scgi.conf include to lighttpd.conf |
|
lineinfile: |
|
path: /etc/lighttpd/lighttpd.conf |
|
line: 'include "mod_scgi.conf"' |
|
insertafter: "{{ '# {{{ includes' }}" |
|
|
|
- name: copy mod_scgi.conf template |
|
template: |
|
src: templates/mod_scgi.conf.j2 |
|
dest: /etc/lighttpd/mod_scgi.conf |
|
|
|
- name: copy uwsgi config |
|
template: |
|
src: "templates/gallery.ini.j2" |
|
dest: "/etc/uwsgi/conf.d/gallery.ini" |
|
owner: uwsgi |
|
group: uwsgi |
|
|
|
- name: clone application repo |
|
git: |
|
repo: '{{ git_repo }}' |
|
dest: '{{ folder }}' |
|
|
|
- name: install application dependencies |
|
pip: |
|
virtualenv: '{{ folder }}/venv' |
|
requirements: '{{ folder }}/requirements.txt' |
|
|
|
- name: chown application to uwsgi user |
|
command: 'chown -R uwsgi:uwsgi {{ folder }}' |
|
|
|
- name: start and enable lighttpd service |
|
service: |
|
name: lighttpd |
|
state: restarted |
|
enabled: yes |
|
|
|
- name: start and enable uwsgi service |
|
service: |
|
name: uwsgi |
|
state: restarted |
|
enabled: yes |
|
|
|
|