Update the nuancier role and add a new template

This commit is contained in:
Pierre-Yves Chibon 2013-09-20 12:01:18 +02:00
parent 8c0bb9b136
commit 2115866868
2 changed files with 74 additions and 4 deletions

View file

@ -10,13 +10,39 @@
- name: copy sundry nuancier configuration
template: >
src={{ item.file }} dest={{ item.location }}/{{ item.file }}
src={{ item.file }} dest={{ item.location }}/{{ item.dest }}
owner=apache group=apache mode=0600
with_items:
- { file: nuancier.cfg, location: /etc/nuancier }
- { file: nuancier.conf, location: /etc/httpd/conf.d }
- { file: nuancier.wsgi, location: /usr/share/nuancier }
- { file: nuancier_admin.cfg, location: /etc/nuancier, dest:nuancier.cfg }
- { file: nuancier.conf, location: /etc/httpd/conf.d, dest: nuancier.conf }
- { file: nuancier.wsgi, location: /usr/share/nuancier, dest: nuancier.wsgi }
tags:
- config
notify:
- restart apache
- name: create pictures folder where we upload the pictures
action: file state=directory path=/var/www/nuancier/pictures
tags:
- setup
- name: create the cache folder where nuancier creates the thumbnails
action: file state=directory path=/var/www/nuancier/cache
owner=apache group=apache
tags:
- setup
- name: create the database scheme
command: NUANCIER_CONFIG=/etc/nuancier/nuancier.cfg /usr/share/nuancier/nuancier-lite_createdb.py
- name: replace the nuancier configuration file by the one with the normal user
template: >
src={{ item.file }} dest={{ item.location }}/{{ item.dest }}
owner=apache group=apache mode=0600
with_items:
- { file: nuancier.cfg, location: /etc/nuancier, dest:nuancier.cfg }
tags:
- config
notify:
- restart apache

View file

@ -0,0 +1,44 @@
# Beware that the quotes around the values are mandatory
import os
### Secret key for the Flask application
SECRET_KEY='{{ nuancier_secret_key }}'
### url to the database server:
DB_URL='postgres://{{ nuancier_db_admin_user }}:{{ nuancier_db_admin_pass }}@{{ nuancier_db_host }}/{{ nuancier_db_name }}'
### The FAS groups in which the admin of nuancier-lite are
### This can either be a single group or multiple, defined between
### parenthesis.
ADMIN_GROUP=('sysadmin-nuancier', 'sysadmin-main')
### Static folder
### The folder containing the css, javascript as well as the pictures
### candidates and the cache of those pictures.
### This directory should be somewhere where apache can access, it's
### proposed in '/var/www/nuancier'
STATIC_FOLDER = '/var/www/nuancier'
### Pictures folder
### The folder in which are located the pictures of the different elections.
### This folder does not have to be writable by the application but should be
### readable.
### /!\ It should be the full path to this folder
PICTURE_FOLDER = os.path.join(STATIC_FOLDER, 'pictures')
### Cache folder
### The folder in which the application will generate thumbnails of the pictures
### selected for an election.
### This folder *must* be *writable* by the application.
### /!\ It should be the full path to this folder
CACHE_FOLDER = os.path.join(STATIC_FOLDER, 'cache')
### Size of the thumbnails (keeping the ratio)
### In order to reduce the loading page of the election page that might contains
### more than hundreds pictures, the application generates thumbnails of each
### pictures.
### The application will keep the ratio intact and just make sure that either
### length or width of the picture fit the length and width specified below.
THUMB_SIZE = (256, 256)