Martin Čaj 0e8bcf
# The profile postgress/server manages some basic postgress
Martin Čaj 0e8bcf
#  files for each server.
Martin Čaj 0e8bcf
Martin Čaj 0e8bcf
{% set id = salt['grains.get']('id').replace('.', '_')  %}
Martin Čaj 0e8bcf
Martin Čaj 0e8bcf
/etc/postgresql/pg_hba.conf:
Martin Čaj 0e8bcf
  file.managed:
Martin Čaj 0e8bcf
    - source: salt://profile/postgresql/files/postgresql/{{ id }}/pg_hba.conf
Martin Čaj 0e8bcf
    - user: root
Martin Čaj 0e8bcf
    - group: postgres
Martin Čaj 0e8bcf
    - mode: 640
Martin Čaj 0e8bcf
Martin Čaj 0e8bcf
/etc/postgresql/pg_ident.conf:
Martin Čaj 0e8bcf
  file.managed:
Martin Čaj 0e8bcf
    - source: salt://profile/postgresql/files/postgresql/{{ id }}/pg_ident.conf
Martin Čaj 0e8bcf
    - user: root
Martin Čaj 0e8bcf
    - group: postgres
Martin Čaj 0e8bcf
    - mode: 640
Martin Čaj 0e8bcf
Martin Čaj 0e8bcf
/etc/postgresql/postgresql.auto.conf:
Martin Čaj 0e8bcf
  file.managed:
Martin Čaj 0e8bcf
    - source: salt://profile/postgresql/files/postgresql/{{ id }}/postgresql.auto.conf
Martin Čaj 0e8bcf
    - user: root
Martin Čaj 0e8bcf
    - group: postgres
Martin Čaj 0e8bcf
    - mode: 640
Martin Čaj 0e8bcf
Martin Čaj 0e8bcf
/etc/postgresql/postgresql.conf:
Martin Čaj 0e8bcf
  file.managed:
Martin Čaj 0e8bcf
    - source: salt://profile/postgresql/files/postgresql/{{ id }}/postgresql.conf
Martin Čaj 0e8bcf
    - user: root
Martin Čaj 0e8bcf
    - group: postgres
Martin Čaj 0e8bcf
    - mode: 640
Martin Čaj 0e8bcf
Martin Čaj 0e8bcf
postgresql.service:
Martin Čaj 0e8bcf
  service.running:
Martin Čaj 0e8bcf
    - name: postgresql
Martin Čaj 0e8bcf
    - enable: True
Martin Čaj 0e8bcf
    - watch:
Martin Čaj 0e8bcf
      - file: /etc/postgresql/pg_hba.conf
Martin Čaj 0e8bcf
      - file: /etc/postgresql/pg_ident.conf
Martin Čaj 0e8bcf
      - file: /etc/postgresql/postgresql.auto.conf
Martin Čaj 0e8bcf
      - file: /etc/postgresql/postgresql.conf