postgres.yml 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. ---
  2. - name: Install postgresql packages
  3. dnf: name={{ item }} state=present
  4. with_items:
  5. - postgresql
  6. - postgresql-server
  7. - postgresql-devel # Allows pip installing psycopg2 is desired
  8. - python-psycopg2
  9. - name: Initialize PostgreSQL
  10. command: postgresql-setup initdb
  11. args:
  12. creates: /var/lib/pgsql/data/pg_hba.conf
  13. - replace:
  14. dest: /var/lib/pgsql/data/pg_hba.conf
  15. regexp: "local all all peer"
  16. replace: "local all all trust"
  17. - replace:
  18. dest: /var/lib/pgsql/data/pg_hba.conf
  19. regexp: "host all all 127.0.0.1/32 ident"
  20. replace: "host all all 127.0.0.1/32 trust"
  21. - replace:
  22. dest: /var/lib/pgsql/data/pg_hba.conf
  23. regexp: "host all all ::1/128 ident"
  24. replace: "host all all ::1/128 trust"
  25. - name: Start postgresql
  26. service: name=postgresql state=restarted enabled=yes
  27. - name: Add a pagure postgres user
  28. postgresql_user: name=pagure role_attr_flags=SUPERUSER,LOGIN
  29. - name: Create a database for pagure
  30. postgresql_db: name=pagure owner=pagure