From 03cd3234a24b87a511d8104cefc44ad5d14756ad Mon Sep 17 00:00:00 2001 From: Pavel Raiskup Date: Jun 06 2019 06:45:54 +0000 Subject: copr: backend: install start postgresql server for resalloc --- diff --git a/roles/copr/backend/tasks/resalloc.yml b/roles/copr/backend/tasks/resalloc.yml index cd03c1f..d66884d 100644 --- a/roles/copr/backend/tasks/resalloc.yml +++ b/roles/copr/backend/tasks/resalloc.yml @@ -1,7 +1,35 @@ - name: install packages needed by resalloc server dnf: state: present - name: ['resalloc-server', 'resalloc', 'sqlite', 'genisoimage', 'virt-install', 'libvirt-client'] + name: + - genisoimage + - libvirt-client + - postgresql-server + - python3-psycopg2 + - resalloc + - resalloc-server + - virt-install + +- name: See if postgreSQL is initialized + stat: path=/var/lib/pgsql/data/PG_VERSION + register: postgres_initialized + +- name: init postgresql + shell: "postgresql-setup initdb" + when: not postgres_initialized.stat.exists + +- name: enable PostgreSQL service + service: state=started enabled=yes name=postgresql + +- name: Create PG user + postgresql_user: name="resalloc" + become: yes + become_user: postgres + +- name: Create db + postgresql_db: name="resalloc" encoding='UTF-8' owner=resalloc + become: yes + become_user: postgres - name: resalloc, sync copr provisioning files synchronize: src="provision/" dest="/var/lib/resallocserver/provision/"