Browse Source

add test for gallery previous installation

master
cinnaboot 5 years ago
parent
commit
c504b9c7ef
  1. 82
      roles/gallery/tasks/main.yml

82
roles/gallery/tasks/main.yml

@ -24,46 +24,58 @@
web_group: lighttpd
proxy_port: 3031
block:
- name: add mod_scgi.conf include to lighttpd.conf
lineinfile:
path: /etc/lighttpd/lighttpd.conf
line: 'include "mod_scgi.conf"'
insertafter: "{{ '# {{{ includes' }}"
- name: test if gallery is already installed
find:
paths: "{{ folder }}"
pattern: README
register: check_installed
- name: copy mod_scgi.conf template
template:
src: templates/mod_scgi.conf.j2
dest: /etc/lighttpd/mod_scgi.conf
- set_fact:
install_gallery: "{{ check_installed.matched == 0 }}"
- name: copy uwsgi config
template:
src: "templates/gallery.ini.j2"
dest: "/etc/uwsgi/conf.d/gallery.ini"
owner: uwsgi
group: uwsgi
- 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: clone application repo
git:
repo: '{{ git_repo }}'
dest: '{{ folder }}'
- name: copy mod_scgi.conf template
template:
src: templates/mod_scgi.conf.j2
dest: /etc/lighttpd/mod_scgi.conf
- name: install application dependencies
pip:
virtualenv: '{{ folder }}/venv'
requirements: '{{ folder }}/requirements.txt'
- name: copy uwsgi config
template:
src: "templates/gallery.ini.j2"
dest: "/etc/uwsgi/conf.d/gallery.ini"
owner: uwsgi
group: uwsgi
- name: chown application to uwsgi user
command: 'chown -R uwsgi:uwsgi {{ folder }}'
- name: clone application repo
git:
repo: '{{ git_repo }}'
dest: '{{ folder }}'
- name: start and enable lighttpd service
service:
name: lighttpd
state: restarted
enabled: yes
- name: install application dependencies
pip:
virtualenv: '{{ folder }}/venv'
requirements: '{{ folder }}/requirements.txt'
- name: start and enable uwsgi service
service:
name: uwsgi
state: restarted
enabled: yes
- 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

Loading…
Cancel
Save