postgres.yml 1.2 KB

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