Move the koji db stuff to it's own role, include in postgres playbook only on kojidb hosts

This commit is contained in:
Kevin Fenzi 2013-09-12 17:42:57 +00:00
parent 63b70b12d4
commit 26f73f413c
4 changed files with 34 additions and 27 deletions

View file

@ -8,3 +8,4 @@ volgroup: /dev/VirtGuests
eth0_ip: 10.5.124.148
vmhost: virthost-comm02.qa.fedoraproject.org
datacenter: phx2
is_kojidb: True

View file

@ -35,8 +35,9 @@
- /srv/web/infra/ansible/roles/rkhunter
- /srv/web/infra/ansible/roles/denyhosts
- /srv/web/infra/ansible/roles/nagios_client
- /srv/web/infra/ansible/roles/postgresql_server
- /srv/web/infra/ansible/roles/fas_client
- /srv/web/infra/ansible/roles/postgresql_server
- /srv/web/infra/ansible/roles/koji_db
tasks:
- include: $tasks/hosts.yml

View file

@ -0,0 +1,31 @@
---
#
# These tasks only run on koji db servers from the postgresql playbook
#
#
# create a koji database if not already created
#
- name: databases creation
postgresql_db: name=koji owner=koji encoding=UTF-8
tags:
- db
only_if: '$is_kojidb'
#
# create a koji db user to own the db with the kojidatabasepassword from private
#
- name: koji db user
postgresql_user: name=koji password=$kojidatabasepassword
tags:
- db
only_if: '$is_kojidb'
#
# Load the initial schema and create a file to note that it's loaded now.
#
- name: load initial schema
shell: creates=/var/lib/pgql/koji-schema psql koji koji < /usr/share/doc/koji*/docs/schema.sql
tags:
- db
only_if: '$is_kojidb'

View file

@ -56,32 +56,6 @@
# setup certs needed here for kojiweb/hub
# Database setup
- name: setup the database
hosts: db-aarch64.qa.fedoraproject.org
gather_facts: no
sudo: yes
sudo_user: postgres
vars_files:
- /srv/web/infra/ansible/vars/global.yml
- ${private}/vars.yml
- ${vars}/${ansible_distribution}.yml
tasks:
- name: databases creation
postgresql_db: name=koji owner=koji encoding=UTF-8
- name: koji db user
postgresql_user: name=koji password=$kojidatabasepassword
tags:
- db
- name: load initial schema
shell: creates=/var/lib/pgql/koji-schema psql koji koji < /usr/share/doc/koji*/docs/schema.sql
tags:
- db
# Todo here
# httpd ssl.conf changes
# koji hub.conf template