diff --git a/roles/kerneltest/tasks/main.yml b/roles/kerneltest/tasks/main.yml new file mode 100644 index 0000000000..d555b7fadd --- /dev/null +++ b/roles/kerneltest/tasks/main.yml @@ -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 diff --git a/roles/kerneltest/templates/kerneltest-proxy.conf b/roles/kerneltest/templates/kerneltest-proxy.conf new file mode 100644 index 0000000000..068896375b --- /dev/null +++ b/roles/kerneltest/templates/kerneltest-proxy.conf @@ -0,0 +1,7 @@ +RewriteEngine On + +ProxyPass <%= path %> <%= proxyurl %>/kerneltest +ProxyPassReverse <%= path %> <%= proxyurl %>/kerneltest + +RequestHeader set X-Forwarded-Scheme https early + diff --git a/roles/kerneltest/templates/kerneltest.cfg b/roles/kerneltest/templates/kerneltest.cfg new file mode 100644 index 0000000000..a4a38ece79 --- /dev/null +++ b/roles/kerneltest/templates/kerneltest.cfg @@ -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 diff --git a/roles/kerneltest/templates/kerneltest.conf b/roles/kerneltest/templates/kerneltest.conf new file mode 100644 index 0000000000..03de4ad715 --- /dev/null +++ b/roles/kerneltest/templates/kerneltest.conf @@ -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 + + + WSGIProcessGroup kerneltest + + # Apache 2.4 + Require all granted + + + # Apache 2.2 + Order deny,allow + Allow from all + + diff --git a/roles/kerneltest/templates/kerneltest.wsgi b/roles/kerneltest/templates/kerneltest.wsgi new file mode 100644 index 0000000000..80d44838dc --- /dev/null +++ b/roles/kerneltest/templates/kerneltest.wsgi @@ -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 +