Add the kerneltest role

This commit is contained in:
Pierre-Yves Chibon 2014-06-17 17:52:59 +02:00
parent 921e313c2d
commit 7bb064b89d
5 changed files with 129 additions and 0 deletions

View file

@ -0,0 +1,48 @@
---
# Configuration for the kerneltest webapp
- name: clean yum metadata
command: yum clean all
tags:
- packages
- name: install needed packages
yum: pkg={{ item }} state=installed
with_items:
- kerneltest
- python-psycopg2
- python-openid-cla
- python-openid-teams
- python-memcached
- libsemanage-python
tags:
- packages
- name: Create the folder to store the logs
action: file state=directory
path=/var/www/logs
owner=apache group=apache mode=0755
- name: Install all the configuration file of kerneltest
template: src={{ item.file }}
dest={{ item.location }}/{{ item.file }}
owner=apache group=apache mode=0600
with_items:
- { file: kerneltest.cfg, location: /etc/kerneltest }
- { file: kerneltest.conf, location: /etc/httpd/conf.d }
- { file: kerneltest.wsgi, location: /var/www/ }
tags:
- config
notify:
- restart apache
- name: create the database scheme
when: inventory_hostname.startswith(('kerneltest01.stg', 'kerneltest02'))
command: /usr/bin/python2 /usr/share/kerneltest/kerneltest_createdb.py
environment:
KERNELTEST_CONFIG: /etc/kerneltest/kerneltest.cfg
- name: set sebooleans so fedocal can talk to the db
action: seboolean name=httpd_can_network_connect_db
state=true
persistent=true

View file

@ -0,0 +1,7 @@
RewriteEngine On
ProxyPass <%= path %> <%= proxyurl %>/kerneltest
ProxyPassReverse <%= path %> <%= proxyurl %>/kerneltest
RequestHeader set X-Forwarded-Scheme https early

View file

@ -0,0 +1,29 @@
# Beware that the quotes around the values are mandatory
### Secret key for the Flask application
SECRET_KEY='{{ kerneltest_secret_key }}'
### url to the database server:
#DB_URL=mysql://user:pass@host/db_name
#DB_URL=postgres://user:pass@host/db_name
DB_URL='postgresql://{{ kerneltest_db_user }}:{{ kerneltest_db_pass }}@{{ kerneltest_db_host }}/{{ kerneltest_db_name }}'
# Specify where the logs of the tests should be stored
LOG_DIR = '/var/www/logs'
# API key used to authenticate the autotest client, should be private as well
API_KEY = 'This is a secret only the cli knows about'
# Email of the admin that should receive the error emails
MAIL_ADMIN = 'pingou@pingoured.fr'
# FAS group or groups (provided as a list) in which should be the admins
# of this application
ADMIN_GROUP = ['sysadmin-kernel', 'sysadmin-main']
# List of MIME types allowed for upload in the application
ALLOWED_MIMETYPES = ['text/plain']
# Restrict the size of content uploaded, this is 10Kb
MAX_CONTENT_LENGTH = 1024 * 10

View file

@ -0,0 +1,23 @@
Alias /kerneltest/static /usr/lib/python2.6/site-packages/kerneltest/static/default/
WSGIDaemonProcess kerneltest user=apache maximum-requests=1000 display-name=kerneltest processes=2 threads=1
WSGISocketPrefix run/wsgi
WSGIRestrictStdout On
WSGIRestrictSignal Off
WSGIPythonOptimize 1
WSGIScriptAlias /kerneltest /var/www/kerneltest.wsgi
<Location />
WSGIProcessGroup kerneltest
<IfModule mod_authz_core.c>
# Apache 2.4
Require all granted
</IfModule>
<IfModule !mod_authz_core.c>
# Apache 2.2
Order deny,allow
Allow from all
</IfModule>
</Location>

View file

@ -0,0 +1,22 @@
#-*- coding: UTF-8 -*-
# The three lines below are required to run on EL6 as EL6 has
# two possible version of python-sqlalchemy and python-jinja2
# These lines make sure the application uses the correct version.
import __main__
__main__.__requires__ = ['SQLAlchemy >= 0.7', 'jinja2 >= 2.4']
import pkg_resources
import os
## Set the environment variable pointing to the configuration file
os.environ['KERNELTEST_CONFIG'] = '/etc/kerneltest/kerneltest.cfg'
## The following is only needed if you did not install kerneltest
## as a python module (for example if you run it from a git clone).
#import sys
#sys.path.insert(0, '/path/to/kerneltest/')
## The most import line to make the wsgi working
from kerneltest.app import APP as application