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

Loading…
Cancel
Save