diff --git a/inventory/host_vars/db-aarch64.qa.fedoraproject.org b/inventory/host_vars/db-aarch64.qa.fedoraproject.org index 8c17f96b50..187eec761e 100644 --- a/inventory/host_vars/db-aarch64.qa.fedoraproject.org +++ b/inventory/host_vars/db-aarch64.qa.fedoraproject.org @@ -8,3 +8,4 @@ volgroup: /dev/VirtGuests eth0_ip: 10.5.124.148 vmhost: virthost-comm02.qa.fedoraproject.org datacenter: phx2 +is_kojidb: True diff --git a/playbooks/groups/postgresl-server.yml b/playbooks/groups/postgresl-server.yml index 724a9ce9db..b830eb2585 100644 --- a/playbooks/groups/postgresl-server.yml +++ b/playbooks/groups/postgresl-server.yml @@ -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 diff --git a/roles/koji_db/tasks/main.yml b/roles/koji_db/tasks/main.yml new file mode 100644 index 0000000000..5b87c17546 --- /dev/null +++ b/roles/koji_db/tasks/main.yml @@ -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' diff --git a/roles/koji_hub/tasks/main.yml b/roles/koji_hub/tasks/main.yml index 2872cb771c..fcefc7aff6 100644 --- a/roles/koji_hub/tasks/main.yml +++ b/roles/koji_hub/tasks/main.yml @@ -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