diff --git a/pillar.example b/pillar.example index 3187231..7c0c707 100644 --- a/pillar.example +++ b/pillar.example @@ -8,4 +8,5 @@ postgres: pkg: postgresql-9.3 db: name: mydb - user: mydb \ No newline at end of file + user: mydb + pg_hba.conf: salt://postgres/pg_hba.conf diff --git a/postgres/init.sls b/postgres/init.sls index 100f79a..0329fb7 100644 --- a/postgres/init.sls +++ b/postgres/init.sls @@ -13,16 +13,18 @@ postgresql: - require: - pkg: {{ postgres.pkg }} +{% if 'pg_hba.conf' in pillar['postgres'] %} pg_hba.conf: file.managed: - name: {{ postgres.pg_hba }} - - source: salt://postgres/pg_hba.conf + - source: {{ pillar['postgres']['pg_hba.conf'] }} - template: jinja - user: postgres - group: postgres - mode: 644 - require: - pkg: {{ postgres.pkg }} +{% endif %} postgres-app-user: postgres_user.present: