Add the configuration and role for ccsdb

This commit is contained in:
Pierre-Yves Chibon 2017-05-30 17:18:53 +02:00
parent 1cb3a9ae19
commit 18e1264696
4 changed files with 107 additions and 1 deletions

View file

@ -57,7 +57,7 @@ resultsdb_frontend_secret_key: "{{ ci_resultsdb_frontend_secret_key }}"
###########################################################
# execdb details
############################################################
###########################################################
execdb_db_host_machine: ci-cc-rdu01.fedoraproject.org
execdb_db_host: "{{ execdb_db_host_machine }}"
execdb_db_port: 5432
@ -68,6 +68,19 @@ execdb_db_password: "{{ ci_execdb_db_password }}"
execdb_secret_key: "{{ ci_execdb_secret_key }}"
###########################################################
# ccsdb details
###########################################################
ccsdb_db_host_machine: ci-cc-rdu01.fedoraproject.org
ccsdb_db_host: "{{ ccsdb_db_host_machine }}"
ccsdb_db_port: 5432
ccsdb_endpoint: 'ccsdb'
ccsdb_db_name: ccsdb
ccsdb_db_user: "{{ ci_ccsdb_db_user }}"
ccsdb_db_password: "{{ ci_ccsdb_db_password }}"
ccsdb_secret_key: "{{ ci_ccsdb_secret_key }}"
############################################################
# fedmsg details
############################################################

View file

@ -0,0 +1,82 @@
---
- name: install ccsdb and its dependencies
yum: name={{ item }} state=present
with_items:
- ccsdb
- mod_wsgi
- python-psycopg2
- libsemanage-python
when: ansible_distribution_major_version|int < 22
tags:
- ccsdb
- name: install ccsdb and its dependencies
dnf: name={{ item }} state=present enablerepo={{ extra_enablerepos }}
with_items:
- ccsdb
- mod_wsgi
- python-psycopg2
- libsemanage-python
when: ansible_distribution_major_version|int > 21 and ansible_cmdline.ostree is not defined
tags:
- ccsdb
- name: ensure database is created
delegate_to: "{{ ccsdb_db_host_machine }}"
become_user: postgres
become: true
postgresql_db: db={{ ccsdb_db_name }}
tags:
- ccsdb
- name: ensure ccsdb db user has access to database
delegate_to: "{{ ccsdb_db_host_machine }}"
become_user: postgres
become: true
postgresql_user: db={{ ccsdb_db_name }}
user={{ ccsdb_db_user }}
password={{ ccsdb_db_password }}
role_attr_flags=NOSUPERUSER
tags:
- ccsdb
- name: ensure selinux lets httpd talk to postgres
seboolean: name=httpd_can_network_connect_db persistent=yes state=yes
tags:
- ccsdb
- name: generate ccsdb config
template: src=ccsdb.cfg dest=/etc/ccsdb/ccsdb.cfg
owner=root group=root mode=0644
notify:
- reload httpd
tags:
- ccsdb
- name: generate ccsdb apache config
template: src=ccsdb.conf dest=/etc/httpd/conf.d/ccsdb.conf
owner=root group=root mode=0644
notify:
- reload httpd
tags:
- ccsdb
- name: create the /usr/share/ccsdb folder
file: state=directory
path=/usr/share/ccsdb
owner=root group=root mode=0755
tags:
- ccsdb
- name: install the wsgi file
template: src=ccsdb.wsgi dest=/usr/share/ccsdb/ccsdb.wsgi
owner=root group=root mode=0644
notify:
- reload httpd
tags:
- ccsdb
- name: initialize execdb database
shell: ccsdb-cli init_db
tags:
- ccsdb

View file

@ -0,0 +1,7 @@
SECRET_KEY = '{{ ccsdb_secret_key }}'
SQLALCHEMY_DATABASE_URI = 'postgresql://{{ ccsdb_db_user }}:{{ ccsdb_db_password }}@{{ ccsdb_db_host }}:{{ ccsdb_db_port }}/{{ ccsdb_db_name }}'
FILE_LOGGING = False
LOGFILR = '/var/log/ccsdb/ccsdb.log'
SYSLOG_LOGGING = False
STREAM_LOGGING = True

View file

@ -0,0 +1,4 @@
import os
os.environ['CCSDB_CONFIG'] = '/etc/ccsdb/ccsdb.cfg'
from ccsdb.app import _app as application