aboutsummaryrefslogtreecommitdiffhomepage
path: root/templates/postgresql.9.4.conf.j2
diff options
context:
space:
mode:
authorPaul B <paul.bonaud@capitainetrain.com>2018-08-31 11:49:09 +0200
committerPaul B <paul.bonaud@capitainetrain.com>2018-08-31 12:00:24 +0200
commitd0bc90e08c29e881c388c6803ed9c49dff1f1776 (patch)
treee5f633a7461f3d339ef89758fc7bb3f1b91563d3 /templates/postgresql.9.4.conf.j2
downloadansible-postgresql-role-d0bc90e08c29e881c388c6803ed9c49dff1f1776.tar.gz
ansible-postgresql-role-d0bc90e08c29e881c388c6803ed9c49dff1f1776.tar.zst
ansible-postgresql-role-d0bc90e08c29e881c388c6803ed9c49dff1f1776.zip
Initial commit open sourcing Postgresql Ansible role1.0.0
Diffstat (limited to 'templates/postgresql.9.4.conf.j2')
-rw-r--r--templates/postgresql.9.4.conf.j2647
1 files changed, 647 insertions, 0 deletions
diff --git a/templates/postgresql.9.4.conf.j2 b/templates/postgresql.9.4.conf.j2
new file mode 100644
index 0000000..c251bfa
--- /dev/null
+++ b/templates/postgresql.9.4.conf.j2
@@ -0,0 +1,647 @@
1# {{ ansible_managed }}
2# -----------------------------
3# PostgreSQL configuration file
4# -----------------------------
5#
6# This file consists of lines of the form:
7#
8# name = value
9#
10# (The "=" is optional.) Whitespace may be used. Comments are introduced with
11# "#" anywhere on a line. The complete list of parameter names and allowed
12# values can be found in the PostgreSQL documentation.
13#
14# The commented-out settings shown in this file represent the default values.
15# Re-commenting a setting is NOT sufficient to revert it to the default value;
16# you need to reload the server.
17#
18# This file is read on server startup and when the server receives a SIGHUP
19# signal. If you edit the file on a running system, you have to SIGHUP the
20# server for the changes to take effect, or use "pg_ctl reload". Some
21# parameters, which are marked below, require a server shutdown and restart to
22# take effect.
23#
24# Any parameter can also be given as a command-line option to the server, e.g.,
25# "postgres -c log_connections=on". Some parameters can be changed at run time
26# with the "SET" SQL command.
27#
28# Memory units: kB = kilobytes Time units: ms = milliseconds
29# MB = megabytes s = seconds
30# GB = gigabytes min = minutes
31# TB = terabytes h = hours
32# d = days
33
34
35#------------------------------------------------------------------------------
36# FILE LOCATIONS
37#------------------------------------------------------------------------------
38
39# The default values of these variables are driven from the -D command-line
40# option or PGDATA environment variable, represented here as ConfigDir.
41
42data_directory = '/var/lib/postgresql/{{ postgres_version }}/{{ postgres_cluster_name }}' # use data in another directory
43 # (change requires restart)
44hba_file = '/etc/postgresql/{{ postgres_version }}/{{ postgres_cluster_name }}/pg_hba.conf' # host-based authentication file
45 # (change requires restart)
46ident_file = '/etc/postgresql/{{ postgres_version }}/{{ postgres_cluster_name }}/pg_ident.conf' # ident configuration file
47 # (change requires restart)
48
49# If external_pid_file is not explicitly set, no extra PID file is written.
50external_pid_file = '/var/run/postgresql/{{ postgres_version }}-{{ postgres_cluster_name }}.pid' # write an extra PID file
51 # (change requires restart)
52
53
54#------------------------------------------------------------------------------
55# CONNECTIONS AND AUTHENTICATION
56#------------------------------------------------------------------------------
57
58# - Connection Settings -
59
60listen_addresses = '{{ postgres_listen_addresses | reject("none") | join(",") }}' # what IP address(es) to listen on;
61 # comma-separated list of addresses;
62 # defaults to 'localhost'; use '*' for all
63 # (change requires restart)
64port = {{ postgres_port }} # (change requires restart)
65max_connections = 400 # (change requires restart)
66# Note: Increasing max_connections costs ~400 bytes of shared memory per
67# connection slot, plus lock space (see max_locks_per_transaction).
68#superuser_reserved_connections = 3 # (change requires restart)
69unix_socket_directories = '/var/run/postgresql' # comma-separated list of directories
70 # (change requires restart)
71#unix_socket_group = '' # (change requires restart)
72#unix_socket_permissions = 0777 # begin with 0 to use octal notation
73 # (change requires restart)
74#bonjour = off # advertise server via Bonjour
75 # (change requires restart)
76#bonjour_name = '' # defaults to the computer name
77 # (change requires restart)
78
79# - Security and Authentication -
80
81#authentication_timeout = 1min # 1s-600s
82ssl = true # (change requires restart)
83#ssl_ciphers = 'HIGH:MEDIUM:+3DES:!aNULL' # allowed SSL ciphers
84 # (change requires restart)
85#ssl_prefer_server_ciphers = on # (change requires restart)
86#ssl_ecdh_curve = 'prime256v1' # (change requires restart)
87#ssl_renegotiation_limit = 512MB # amount of data between renegotiations
88ssl_cert_file = '/etc/ssl/certs/ssl-cert-snakeoil.pem' # (change requires restart)
89ssl_key_file = '/etc/ssl/private/ssl-cert-snakeoil.key' # (change requires restart)
90#ssl_ca_file = '' # (change requires restart)
91#ssl_crl_file = '' # (change requires restart)
92#password_encryption = on
93#db_user_namespace = off
94
95# GSSAPI using Kerberos
96#krb_server_keyfile = ''
97#krb_caseins_users = off
98
99# - TCP Keepalives -
100# see "man 7 tcp" for details
101
102#tcp_keepalives_idle = 0 # TCP_KEEPIDLE, in seconds;
103 # 0 selects the system default
104#tcp_keepalives_interval = 0 # TCP_KEEPINTVL, in seconds;
105 # 0 selects the system default
106#tcp_keepalives_count = 0 # TCP_KEEPCNT;
107 # 0 selects the system default
108
109
110#------------------------------------------------------------------------------
111# RESOURCE USAGE (except WAL)
112#------------------------------------------------------------------------------
113
114# - Memory -
115
116{% if ansible_memtotal_mb > 65536 %}
117shared_buffers = 16GB # min 128kB
118{% else %}
119shared_buffers = {{ ansible_memtotal_mb // 4 }}MB # min 128kB
120{% endif %}
121 # (change requires restart)
122#huge_pages = try # on, off, or try
123 # (change requires restart)
124#temp_buffers = 8MB # min 800kB
125#max_prepared_transactions = 0 # zero disables the feature
126 # (change requires restart)
127# Note: Increasing max_prepared_transactions costs ~600 bytes of shared memory
128# per transaction slot, plus lock space (see max_locks_per_transaction).
129# It is not advisable to set max_prepared_transactions nonzero unless you
130# actively intend to use prepared transactions.
131#work_mem = 4MB # min 64kB
132#maintenance_work_mem = 64MB # min 1MB
133#autovacuum_work_mem = -1 # min 1MB, or -1 to use maintenance_work_mem
134#max_stack_depth = 2MB # min 100kB
135dynamic_shared_memory_type = posix # the default is the first option
136 # supported by the operating system:
137 # posix
138 # sysv
139 # windows
140 # mmap
141 # use none to disable dynamic shared memory
142
143# - Disk -
144
145#temp_file_limit = -1 # limits per-session temp file space
146 # in kB, or -1 for no limit
147
148# - Kernel Resource Usage -
149
150#max_files_per_process = 1000 # min 25
151 # (change requires restart)
152#shared_preload_libraries = '' # (change requires restart)
153
154# - Cost-Based Vacuum Delay -
155
156#vacuum_cost_delay = 0 # 0-100 milliseconds
157#vacuum_cost_page_hit = 1 # 0-10000 credits
158#vacuum_cost_page_miss = 10 # 0-10000 credits
159#vacuum_cost_page_dirty = 20 # 0-10000 credits
160#vacuum_cost_limit = 200 # 1-10000 credits
161
162# - Background Writer -
163
164#bgwriter_delay = 200ms # 10-10000ms between rounds
165#bgwriter_lru_maxpages = 100 # 0-1000 max buffers written/round
166#bgwriter_lru_multiplier = 2.0 # 0-10.0 multipler on buffers scanned/round
167
168# - Asynchronous Behavior -
169
170#effective_io_concurrency = 1 # 1-1000; 0 disables prefetching
171#max_worker_processes = 8
172
173
174#------------------------------------------------------------------------------
175# WRITE AHEAD LOG
176#------------------------------------------------------------------------------
177
178# - Settings -
179
180wal_level = logical # minimal, archive, hot_standby, or logical
181 # (change requires restart)
182
183{% if postgres_fsync_enabled %}
184#fsync = on # turns forced synchronization on or off
185#synchronous_commit = on # synchronization level;
186{% else %}
187fsync = off # turns forced synchronization on or off
188synchronous_commit = off # synchronization level;
189{% endif %}
190 # off, local, remote_write, or on
191#wal_sync_method = fsync # the default is the first option
192 # supported by the operating system:
193 # open_datasync
194 # fdatasync (default on Linux)
195 # fsync
196 # fsync_writethrough
197 # open_sync
198#full_page_writes = on # recover from partial page writes
199wal_log_hints = on # also do full page writes of non-critical updates
200 # (change requires restart)
201#wal_buffers = -1 # min 32kB, -1 sets based on shared_buffers
202 # (change requires restart)
203#wal_writer_delay = 200ms # 1-10000 milliseconds
204
205#commit_delay = 0 # range 0-100000, in microseconds
206#commit_siblings = 5 # range 1-1000
207
208# - Checkpoints -
209
210#checkpoint_segments = 3 # in logfile segments, min 1, 16MB each
211#checkpoint_timeout = 5min # range 30s-1h
212#checkpoint_completion_target = 0.5 # checkpoint target duration, 0.0 - 1.0
213#checkpoint_warning = 30s # 0 disables
214
215# - Archiving -
216
217{% if postgres_archive_enabled %}
218archive_mode = on
219archive_command = 'rsync -a %p barman@{{ postgres_barman_server }}:/var/lib/barman/{{ barman_directory }}/incoming/%f'
220{% else %}
221archive_mode = off
222archive_command = ''
223{% endif %}
224
225#archive_mode = off # enables archiving; off, on, or always
226 # (change requires restart)
227#archive_command = '' # command to use to archive a logfile segment
228 # placeholders: %p = path of file to archive
229 # %f = file name only
230 # e.g. 'test ! -f /mnt/server/archivedir/%f && cp %p /mnt/server/archivedir/%f'
231#archive_timeout = 0 # force a logfile segment switch after this
232 # number of seconds; 0 disables
233
234
235#------------------------------------------------------------------------------
236# REPLICATION
237#------------------------------------------------------------------------------
238
239# - Sending Server(s) -
240
241# Set these on the master and on any standby that will send replication data.
242
243max_wal_senders = 5 # max number of walsender processes
244 # (change requires restart)
245wal_keep_segments = 16 # in logfile segments, 16MB each; 0 disables
246#wal_sender_timeout = 60s # in milliseconds; 0 disables
247
248{% if postgres_max_replication_slots is defined %}
249max_replication_slots = {{ postgres_max_replication_slots }} # max number of replication slots
250{% else %}
251#max_replication_slots = 0 # max number of replication slots
252{% endif %}
253 # (change requires restart)
254
255# - Master Server -
256
257# These settings are ignored on a standby server.
258
259#synchronous_standby_names = '' # standby servers that provide sync rep
260 # comma-separated list of application_name
261 # from standby(s); '*' = all
262#vacuum_defer_cleanup_age = 0 # number of xacts by which cleanup is delayed
263
264# - Standby Servers -
265
266# These settings are ignored on a master server.
267
268hot_standby = on # "on" allows queries during recovery
269 # (change requires restart)
270#max_standby_archive_delay = 30s # max delay before canceling queries
271 # when reading WAL from archive;
272 # -1 allows indefinite delay
273max_standby_streaming_delay = {{ postgres_extra_config.max_standby_streaming_delay | default('600s') }} # max delay before canceling queries
274 # when reading streaming WAL;
275 # -1 allows indefinite delay
276#wal_receiver_status_interval = 10s # send replies at least this often
277 # 0 disables
278#hot_standby_feedback = off # send info from standby to prevent
279 # query conflicts
280#wal_receiver_timeout = 60s # time that receiver waits for
281 # communication from master
282 # in milliseconds; 0 disables
283
284
285#------------------------------------------------------------------------------
286# QUERY TUNING
287#------------------------------------------------------------------------------
288
289# - Planner Method Configuration -
290
291#enable_bitmapscan = on
292#enable_hashagg = on
293#enable_hashjoin = on
294#enable_indexscan = on
295#enable_indexonlyscan = on
296#enable_material = on
297#enable_mergejoin = on
298#enable_nestloop = on
299#enable_seqscan = on
300#enable_sort = on
301#enable_tidscan = on
302
303# - Planner Cost Constants -
304
305#seq_page_cost = 1.0 # measured on an arbitrary scale
306{% if postgres_specific_random_page_cost is defined -%}
307# Random page cost is an arbitrary value relative to the seq_page_cost conf (default 1.0)
308# On SSD disk it is better to lower the default value from 4.0 to 1.0 for instance.
309random_page_cost = {{ postgres_specific_random_page_cost }} # same scale as above
310{% else -%}
311#random_page_cost = 4.0 # same scale as above
312{% endif %}
313#cpu_tuple_cost = 0.01 # same scale as above
314#cpu_index_tuple_cost = 0.005 # same scale as above
315#cpu_operator_cost = 0.0025 # same scale as above
316effective_cache_size = {{ ansible_memtotal_mb // 2 }}MB
317
318# - Genetic Query Optimizer -
319
320#geqo = on
321#geqo_threshold = 12
322#geqo_effort = 5 # range 1-10
323#geqo_pool_size = 0 # selects default based on effort
324#geqo_generations = 0 # selects default based on effort
325#geqo_selection_bias = 2.0 # range 1.5-2.0
326#geqo_seed = 0.0 # range 0.0-1.0
327
328# - Other Planner Options -
329
330#default_statistics_target = 100 # range 1-10000
331#constraint_exclusion = partition # on, off, or partition
332#cursor_tuple_fraction = 0.1 # range 0.0-1.0
333#from_collapse_limit = 8
334#join_collapse_limit = 8 # 1 disables collapsing of explicit
335 # JOIN clauses
336
337
338#------------------------------------------------------------------------------
339# ERROR REPORTING AND LOGGING
340#------------------------------------------------------------------------------
341
342# - Where to Log -
343
344#log_destination = 'stderr' # Valid values are combinations of
345 # stderr, csvlog, syslog, and eventlog,
346 # depending on platform. csvlog
347 # requires logging_collector to be on.
348
349# This is used when logging to stderr:
350#logging_collector = off # Enable capturing of stderr and csvlog
351 # into log files. Required to be on for
352 # csvlogs.
353 # (change requires restart)
354
355# These are only used if logging_collector is on:
356#log_directory = 'pg_log' # directory where log files are written,
357 # can be absolute or relative to PGDATA
358#log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log' # log file name pattern,
359 # can include strftime() escapes
360#log_file_mode = 0600 # creation mode for log files,
361 # begin with 0 to use octal notation
362#log_truncate_on_rotation = off # If on, an existing log file with the
363 # same name as the new log file will be
364 # truncated rather than appended to.
365 # But such truncation only occurs on
366 # time-driven rotation, not on restarts
367 # or size-driven rotation. Default is
368 # off, meaning append to existing files
369 # in all cases.
370#log_rotation_age = 1d # Automatic rotation of logfiles will
371 # happen after that time. 0 disables.
372#log_rotation_size = 10MB # Automatic rotation of logfiles will
373 # happen after that much log output.
374 # 0 disables.
375
376# These are relevant when logging to syslog:
377#syslog_facility = 'LOCAL0'
378#syslog_ident = 'postgres'
379
380# This is only relevant when logging to eventlog (win32):
381#event_source = 'PostgreSQL'
382
383# - When to Log -
384
385#client_min_messages = notice # values in order of decreasing detail:
386 # debug5
387 # debug4
388 # debug3
389 # debug2
390 # debug1
391 # log
392 # notice
393 # warning
394 # error
395
396#log_min_messages = warning # values in order of decreasing detail:
397 # debug5
398 # debug4
399 # debug3
400 # debug2
401 # debug1
402 # info
403 # notice
404 # warning
405 # error
406 # log
407 # fatal
408 # panic
409
410#log_min_error_statement = error # values in order of decreasing detail:
411 # debug5
412 # debug4
413 # debug3
414 # debug2
415 # debug1
416 # info
417 # notice
418 # warning
419 # error
420 # log
421 # fatal
422 # panic (effectively off)
423
424log_min_duration_statement = 10000 # -1 is disabled, 0 logs all statements
425 # and their durations, > 0 logs only
426 # statements running at least this number
427 # of milliseconds
428
429
430# - What to Log -
431
432#debug_print_parse = off
433#debug_print_rewritten = off
434#debug_print_plan = off
435#debug_pretty_print = on
436#log_checkpoints = off
437#log_connections = off
438#log_disconnections = off
439#log_duration = off
440#log_error_verbosity = default # terse, default, or verbose messages
441#log_hostname = off
442
443log_line_prefix = '{{ postgres_log_line_prefix }}'
444#log_line_prefix = '%t ' # special values:
445 # %a = application name
446 # %u = user name
447 # %d = database name
448 # %r = remote host and port
449 # %h = remote host
450 # %p = process ID
451 # %t = timestamp without milliseconds
452 # %m = timestamp with milliseconds
453 # %i = command tag
454 # %e = SQL state
455 # %c = session ID
456 # %l = session line number
457 # %s = session start timestamp
458 # %v = virtual transaction ID
459 # %x = transaction ID (0 if none)
460 # %q = stop here in non-session
461 # processes
462 # %% = '%'
463 # e.g. '<%u%%%d> '
464#log_lock_waits = off # log lock waits >= deadlock_timeout
465#log_statement = 'none' # none, ddl, mod, all
466#log_temp_files = -1 # log temporary files equal or larger
467 # than the specified size in kilobytes;
468 # -1 disables, 0 logs all temp files
469log_timezone = 'GMT'
470
471
472#------------------------------------------------------------------------------
473# RUNTIME STATISTICS
474#------------------------------------------------------------------------------
475
476# - Query/Index Statistics Collector -
477
478#track_activities = on
479#track_counts = on
480#track_io_timing = off
481#track_functions = none # none, pl, all
482#track_activity_query_size = 1024 # (change requires restart)
483stats_temp_directory = '/var/run/postgresql/{{ postgres_version }}-{{ postgres_cluster_name }}.pg_stat_tmp'
484
485
486# - Statistics Monitoring -
487
488#log_parser_stats = off
489#log_planner_stats = off
490#log_executor_stats = off
491#log_statement_stats = off
492
493
494#------------------------------------------------------------------------------
495# AUTOVACUUM PARAMETERS
496#------------------------------------------------------------------------------
497
498#autovacuum = on # Enable autovacuum subprocess? 'on'
499 # requires track_counts to also be on.
500#log_autovacuum_min_duration = -1 # -1 disables, 0 logs all actions and
501 # their durations, > 0 logs only
502 # actions running at least this number
503 # of milliseconds.
504#autovacuum_max_workers = 3 # max number of autovacuum subprocesses
505 # (change requires restart)
506#autovacuum_naptime = 1min # time between autovacuum runs
507#autovacuum_vacuum_threshold = 50 # min number of row updates before
508 # vacuum
509#autovacuum_analyze_threshold = 50 # min number of row updates before
510 # analyze
511#autovacuum_vacuum_scale_factor = 0.2 # fraction of table size before vacuum
512#autovacuum_analyze_scale_factor = 0.1 # fraction of table size before analyze
513#autovacuum_freeze_max_age = 200000000 # maximum XID age before forced vacuum
514 # (change requires restart)
515#autovacuum_multixact_freeze_max_age = 400000000 # maximum multixact age
516 # before forced vacuum
517 # (change requires restart)
518#autovacuum_vacuum_cost_delay = 20ms # default vacuum cost delay for
519 # autovacuum, in milliseconds;
520 # -1 means use vacuum_cost_delay
521#autovacuum_vacuum_cost_limit = -1 # default vacuum cost limit for
522 # autovacuum, -1 means use
523 # vacuum_cost_limit
524
525
526#------------------------------------------------------------------------------
527# CLIENT CONNECTION DEFAULTS
528#------------------------------------------------------------------------------
529
530# - Statement Behavior -
531
532#search_path = '"$user",public' # schema names
533#default_tablespace = '' # a tablespace name, '' uses the default
534#temp_tablespaces = '' # a list of tablespace names, '' uses
535 # only default tablespace
536#check_function_bodies = on
537#default_transaction_isolation = 'read committed'
538#default_transaction_read_only = off
539#default_transaction_deferrable = off
540#session_replication_role = 'origin'
541#statement_timeout = 0 # in milliseconds, 0 is disabled
542#lock_timeout = 0 # in milliseconds, 0 is disabled
543#vacuum_freeze_min_age = 50000000
544#vacuum_freeze_table_age = 150000000
545#vacuum_multixact_freeze_min_age = 5000000
546#vacuum_multixact_freeze_table_age = 150000000
547#bytea_output = 'hex' # hex, escape
548#xmlbinary = 'base64'
549#xmloption = 'content'
550
551# - Locale and Formatting -
552
553datestyle = '{{ postgres_datestyle }}'
554#intervalstyle = 'postgres'
555#timezone = '(defaults to server environment setting)'
556{% if postgres_timezone is defined %}
557timezone = '{{ postgres_timezone }}'
558{% endif %}
559#timezone_abbreviations = 'Default' # Select the set of available time zone
560 # abbreviations. Currently, there are
561 # Default
562 # Australia (historical usage)
563 # India
564 # You can create your own file in
565 # share/timezonesets/.
566#extra_float_digits = 0 # min -15, max 3
567#client_encoding = sql_ascii # actually, defaults to database
568 # encoding
569
570# These settings are initialized by initdb, but they can be changed.
571lc_messages = '{{ postgres_locale_system }}' # locale for system error message
572 # strings
573lc_monetary = '{{ postgres_locale_formats }}' # locale for monetary formatting
574lc_numeric = '{{ postgres_locale_formats }}' # locale for number formatting
575lc_time = '{{ postgres_locale_formats }}' # locale for time formatting
576
577# default configuration for text search
578default_text_search_config = '{{ postgres_text_search_config }}'
579
580# - Other Defaults -
581
582#dynamic_library_path = '$libdir'
583#local_preload_libraries = ''
584#session_preload_libraries = ''
585
586
587#------------------------------------------------------------------------------
588# LOCK MANAGEMENT
589#------------------------------------------------------------------------------
590
591#deadlock_timeout = 1s
592#max_locks_per_transaction = 64 # min 10
593 # (change requires restart)
594# Note: Each lock table slot uses ~270 bytes of shared memory, and there are
595# max_locks_per_transaction * (max_connections + max_prepared_transactions)
596# lock table slots.
597#max_pred_locks_per_transaction = 64 # min 10
598 # (change requires restart)
599
600
601#------------------------------------------------------------------------------
602# VERSION/PLATFORM COMPATIBILITY
603#------------------------------------------------------------------------------
604
605# - Previous PostgreSQL Versions -
606
607#array_nulls = on
608#backslash_quote = safe_encoding # on, off, or safe_encoding
609#default_with_oids = off
610#escape_string_warning = on
611#lo_compat_privileges = off
612#quote_all_identifiers = off
613#sql_inheritance = on
614#standard_conforming_strings = on
615#synchronize_seqscans = on
616
617# - Other Platforms and Clients -
618
619#transform_null_equals = off
620
621
622#------------------------------------------------------------------------------
623# ERROR HANDLING
624#------------------------------------------------------------------------------
625
626#exit_on_error = off # terminate session on any error?
627#restart_after_crash = on # reinitialize after backend crash?
628
629
630#------------------------------------------------------------------------------
631# CONFIG FILE INCLUDES
632#------------------------------------------------------------------------------
633
634# These options allow settings to be loaded from files other than the
635# default postgresql.conf.
636
637#include_dir = 'conf.d' # include files ending in '.conf' from
638 # directory 'conf.d'
639#include_if_exists = 'exists.conf' # include file only if it exists
640#include = 'special.conf' # include file
641
642
643#------------------------------------------------------------------------------
644# CUSTOMIZED OPTIONS
645#------------------------------------------------------------------------------
646
647# Add settings for extensions here