Blame ansible/roles/pagure-dev/tasks/postgres.yml

Jeremy Cline 4e3668
---
Jeremy Cline 4e3668
Jeremy Cline 4e3668
- name: Install postgresql packages
Jeremy Cline 4e3668
  dnf: name={{ item }} state=present
Jeremy Cline 4e3668
  with_items:
Jeremy Cline 4e3668
      - postgresql
Jeremy Cline 4e3668
      - postgresql-server
Jeremy Cline 4e3668
      - postgresql-devel  # Allows pip installing psycopg2 is desired
Jeremy Cline 4e3668
      - python-psycopg2
Jeremy Cline 4e3668
Jeremy Cline 4e3668
- name: Initialize PostgreSQL
Jeremy Cline 4e3668
  command: postgresql-setup initdb
Jeremy Cline 4e3668
  args:
Jeremy Cline 4e3668
      creates: /var/lib/pgsql/data/pg_hba.conf
Jeremy Cline 4e3668
Jeremy Cline 4e3668
- replace:
Jeremy Cline 4e3668
    dest: /var/lib/pgsql/data/pg_hba.conf
Jeremy Cline 4e3668
    regexp: "local   all             all                                     peer"
Jeremy Cline 4e3668
    replace: "local   all             all                                     trust"
Jeremy Cline 4e3668
Jeremy Cline 4e3668
- replace:
Jeremy Cline 4e3668
    dest: /var/lib/pgsql/data/pg_hba.conf
Jeremy Cline 4e3668
    regexp: "host    all             all             127.0.0.1/32            ident"
Jeremy Cline 4e3668
    replace: "host    all             all             127.0.0.1/32            trust"
Jeremy Cline 4e3668
Jeremy Cline 4e3668
- replace:
Jeremy Cline 4e3668
    dest: /var/lib/pgsql/data/pg_hba.conf
Jeremy Cline 4e3668
    regexp: "host    all             all             ::1/128                 ident"
Jeremy Cline 4e3668
    replace: "host    all             all             ::1/128                 trust"
Jeremy Cline 4e3668
Jeremy Cline 4e3668
- name: Start postgresql
Jeremy Cline 4e3668
  service: name=postgresql state=restarted enabled=yes
Jeremy Cline 4e3668
Jeremy Cline 4e3668
- name: Add a pagure postgres user
Jeremy Cline 4e3668
  postgresql_user: name=pagure role_attr_flags=SUPERUSER,LOGIN
Jeremy Cline 4e3668
Jeremy Cline 4e3668
- name: Create a database for pagure
Jeremy Cline 4e3668
  postgresql_db: name=pagure owner=pagure