Merge pull request #20 from berry-langerak/feature/adding-config-to-postgresql-conf
Added the ability to add custom configuration to postgresql.conf.
This commit is contained in:
@@ -34,3 +34,8 @@ postgres:
|
|||||||
template: 'template0'
|
template: 'template0'
|
||||||
lc_ctype: 'C.UTF-8'
|
lc_ctype: 'C.UTF-8'
|
||||||
lc_collate: 'C.UTF-8'
|
lc_collate: 'C.UTF-8'
|
||||||
|
|
||||||
|
# This section will append your configuration to postgresql.conf.
|
||||||
|
postgresconf: |
|
||||||
|
listen_addresses = 'localhost,*'
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
{% from "postgres/map.jinja" import postgres with context %}
|
{% from "postgres/map.jinja" import postgres with context %}
|
||||||
|
|
||||||
|
|
||||||
install-postgresql:
|
install-postgresql:
|
||||||
pkg.installed:
|
pkg.installed:
|
||||||
- name: {{ postgres.pkg }}
|
- name: {{ postgres.pkg }}
|
||||||
@@ -43,6 +42,19 @@ install-postgres-dev-package:
|
|||||||
{{ postgres.pkg_libpq_dev }}:
|
{{ postgres.pkg_libpq_dev }}:
|
||||||
pkg.installed
|
pkg.installed
|
||||||
|
|
||||||
|
{% if 'postgresconf' in pillar.get('postgres', {}) %}
|
||||||
|
postgresql-conf:
|
||||||
|
file.blockreplace:
|
||||||
|
- name: {{ postgres.conf_dir }}/postgresql.conf
|
||||||
|
- marker_start: "# Managed by SaltStack: listen_addresses: please do not edit"
|
||||||
|
- marker_end: "# Managed by SaltStack: end of salt managed zone --"
|
||||||
|
- content: {{ salt['pillar.get']('postgres:postgresconf') }}
|
||||||
|
- show_changes: True
|
||||||
|
- append_if_not_found: True
|
||||||
|
- watch_in:
|
||||||
|
- service: postgresql
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% if 'pg_hba.conf' in pillar.get('postgres', {}) %}
|
{% if 'pg_hba.conf' in pillar.get('postgres', {}) %}
|
||||||
pg_hba.conf:
|
pg_hba.conf:
|
||||||
file.managed:
|
file.managed:
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
'pkg_libpq_dev': 'libpq-dev',
|
'pkg_libpq_dev': 'libpq-dev',
|
||||||
'python': 'python-pygresql',
|
'python': 'python-pygresql',
|
||||||
'service': 'postgresql',
|
'service': 'postgresql',
|
||||||
|
'pg_hba': '/etc/postgresql/9.1/main/pg_hba.conf',
|
||||||
'conf_dir': '/etc/postgresql/9.1/main',
|
'conf_dir': '/etc/postgresql/9.1/main',
|
||||||
'create_cluster': False,
|
'create_cluster': False,
|
||||||
'init_db': False,
|
'init_db': False,
|
||||||
@@ -27,9 +28,9 @@
|
|||||||
'pkg_libpq_dev': 'postgresql-libs',
|
'pkg_libpq_dev': 'postgresql-libs',
|
||||||
'python': 'python-psycopg2',
|
'python': 'python-psycopg2',
|
||||||
'service': 'postgresql',
|
'service': 'postgresql',
|
||||||
'conf_dir': '/var/lib/pgsql/data/',
|
'conf_dir': '/var/lib/pgsql/data',
|
||||||
'create_cluster': False,
|
'create_cluster': False,
|
||||||
'init_db': False,
|
'init_db': True,
|
||||||
'version': '9.1',
|
'version': '9.1',
|
||||||
},
|
},
|
||||||
}, merge=salt['grains.filter_by']({
|
}, merge=salt['grains.filter_by']({
|
||||||
|
|||||||
Reference in New Issue
Block a user