forked from ANXS/postgresql
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.yml
809 lines (637 loc) · 29 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
# file: postgresql/defaults/main.yml
# Basic settings
postgresql_version: 9.6
postgresql_encoding: "UTF-8"
postgresql_data_checksums: false
postgresql_pwfile: ""
postgresql_locale_parts:
- "en_US" # Locale
- "UTF-8" # Encoding
postgresql_locale: "{{ postgresql_locale_parts | join('.') }}"
postgresql_ctype_parts:
- "en_US" # Locale
- "UTF-8" # Encoding
postgresql_ctype: "{{ postgresql_ctype_parts | join('.') }}"
postgresql_admin_user: "postgres"
postgresql_default_auth_method: "trust"
# The user/group that will run postgresql process or service
postgresql_service_user: "{{ postgresql_admin_user }}"
postgresql_service_group: "{{ postgresql_admin_user }}"
postgresql_service_enabled: true
postgresql_cluster_name: "main"
postgresql_cluster_reset: false
postgresql_database_owner: "{{ postgresql_admin_user }}"
# Extensions
postgresql_ext_install_contrib: no
postgresql_ext_install_dev_headers: no
postgresql_ext_install_postgis: no
postgresql_ext_postgis_version: "2.1" # be careful: check whether the postgresql/postgis versions work together
postgresql_ext_postgis_deps:
- libgeos-c1
- "postgresql-{{ postgresql_version }}-postgis-{{ postgresql_ext_postgis_version }}"
- "postgresql-{{ postgresql_version }}-postgis-scripts"
# List of databases to be created (optional)
postgresql_databases: []
# List of database extensions to be created (optional)
postgresql_database_extensions: []
# List of users to be created (optional)
postgresql_users: []
# List of schemas to be created (optional)
postgresql_database_schemas: []
# List of user privileges to be applied (optional)
postgresql_user_privileges: []
# pg_hba.conf
postgresql_pg_hba_default:
- { type: local, database: all, user: "{{ postgresql_admin_user }}", address: "", method: "{{ postgresql_default_auth_method }}", comment: "" }
- { type: local, database: all, user: all, address: "", method: "{{ postgresql_default_auth_method }}", comment: '"local" is for Unix domain socket connections only' }
- { type: host, database: all, user: all, address: "127.0.0.1/32", method: "{{ postgresql_default_auth_method }}", comment: "IPv4 local connections:" }
- { type: host, database: all, user: all, address: "::1/128", method: "{{ postgresql_default_auth_method }}", comment: "IPv6 local connections:" }
- { type: local, database: all, user: "{{ postgresql_admin_user }}", address: "", method: "peer map=root_as_{{ postgresql_admin_user }}", comment: "Local root Unix user, passwordless access" }
postgresql_pg_hba_passwd_hosts: []
postgresql_pg_hba_trust_hosts: []
postgresql_pg_hba_custom: []
# pg_ident.conf
postgresql_pg_ident:
- comment: "root is allowed to login as {{ postgresql_admin_user }}"
mapname: "root_as_{{ postgresql_admin_user }}"
system_username: "{{ postgresql_admin_user }}"
pg_username: "{{ postgresql_admin_user }}"
# postgresql.conf
#------------------------------------------------------------------------------
# FILE LOCATIONS
#------------------------------------------------------------------------------
# Location of postgres configuration files here
postgresql_conf_directory: "/etc/postgresql/{{ postgresql_version }}/{{ postgresql_cluster_name }}"
# HBA (Host Based Authentication) file
postgresql_hba_file: "{{ postgresql_conf_directory }}/pg_hba.conf"
# Ident configuration file
postgresql_ident_file: "{{ postgresql_conf_directory }}/pg_ident.conf"
# Use data in another directory
postgresql_varlib_directory_name: "postgresql"
postgresql_data_directory: "/var/lib/{{ postgresql_varlib_directory_name }}/{{ postgresql_version }}/{{ postgresql_cluster_name }}"
postgresql_wal_directory: ""
postgresql_pid_directory: "/var/run/postgresql"
# If external_pid_file is not explicitly set, on extra PID file is written
postgresql_external_pid_file: "{{ postgresql_pid_directory }}/{{ postgresql_version }}-{{ postgresql_cluster_name }}.pid"
#------------------------------------------------------------------------------
# CONNECTIONS AND AUTHENTICATION
#------------------------------------------------------------------------------
postgresql_listen_addresses:
- "localhost"
postgresql_port: 5432
postgresql_max_connections: 100
postgresql_superuser_reserved_connections: 3
postgresql_unix_socket_directory: "" # (<= 9.2)
postgresql_unix_socket_directories: # (>= 9.3)
- "{{ postgresql_pid_directory }}"
postgresql_unix_socket_group: ""
postgresql_unix_socket_permissions: "0777" # begin with 0 to use octal notation
# Automatic pg_ctl configuration. Specify a list of options containing
# cluster specific options to be passed to pg_ctl(1).
postgresql_pg_ctl_options: []
postgresql_bonjour: off # advertise server via Bonjour
postgresql_bonjour_name: "" # defaults to the computer name
# - Security and Authentication -
postgresql_authentication_timeout: 60s
postgresql_ssl: off
postgresql_ssl_ciphers:
- "DEFAULT"
- "!LOW"
- "!EXP"
- "!MD5"
- "@STRENGTH"
postgresql_ssl_prefer_server_ciphers: on
postgresql_ssl_ecdh_curve: "prime256v1"
postgresal_ssl_dh_params_file: "" # (>= 10)
postgresql_ssl_renegotiation_limit: 512MB # amount of data between renegotiations
postgresql_ssl_cert_file: "/etc/ssl/certs/ssl-cert-snakeoil.pem" # (>= 9.2)
postgresql_ssl_key_file: "/etc/ssl/private/ssl-cert-snakeoil.key" # (>= 9.2)
postgresql_ssl_ca_file: "" # (>= 9.2)
postgresql_ssl_crl_file: "" # (>= 9.2)
postgresql_password_encryption: on
postgresql_db_user_namespace: off
postgresql_row_security: off # (>= 9.5)
# Kerberos and GSSAPI
postgresql_krb_server_keyfile: ""
postgresql_krb_srvname: "postgres" # (<= 9.3)
postgresql_krb_caseins_users: off
# TCP Keepalives, 0 selects the system default (in seconds)
postgresql_tcp_keepalives_idle: 0
postgresql_tcp_keepalives_interval: 0
postgresql_tcp_keepalives_count: 0
#------------------------------------------------------------------------------
# RESOURCE USAGE (except WAL)
#------------------------------------------------------------------------------
# - Memory -
postgresql_shared_buffers: 128MB # min 128kB
postgresql_huge_pages: "try" # on, off, or try
postgresql_temp_buffers: 8MB # min 800kB
# Caution: it is not advisable to set max_prepared_transactions nonzero unless
# you actively intend to use prepared transactions.
postgresql_max_prepared_transactions: 0 # zero disables the feature
postgresql_work_mem: 1MB # min 64kB
postgresql_maintenance_work_mem: 16MB # min 1MB
postgresql_replacement_sort_tuples: 150000 # (>= 9.6) limits use of replacement selection sort
postgresql_autovacuum_work_mem: -1 # min 1MB, or -1 to use maintenance_work_mem
postgresql_max_stack_depth: 2MB # min 100kB
postgresql_dynamic_shared_memory_type: "posix" # the default is the first option
# supported by the operating system:
# posix
# sysv
# windows
# mmap
# use none to disable dynamic shared memory
# - Disk -
# limits per-process temp file space in kB, or -1 for no limit (>= 9.2)
postgresql_temp_file_limit: -1
# - Kernel Resource Usage -
postgresql_max_files_per_process: 1000 # min 25
postgresql_shared_preload_libraries: []
# - Cost-Based Vacuum Delay -
postgresql_vacuum_cost_delay: 0 # 0-100 milliseconds
postgresql_vacuum_cost_page_hit: 1 # 0-10000 credits
postgresql_vacuum_cost_page_miss: 10 # 0-10000 credits
postgresql_vacuum_cost_page_dirty: 20 # 0-10000 credits
postgresql_vacuum_cost_limit: 200 # 1-10000 credits
# - Background Writer -
postgresql_bgwriter_delay: 200ms # 10-10000ms between rounds
postgresql_bgwriter_lru_maxpages: 100 # 0-1000 max buffers written/round
postgresql_bgwriter_lru_multiplier: 2.0 # 0-10.0 multiplier on buffers scanned/round
postgresql_bgwriter_flush_after: 0 # (>= 9.6) 0 disables,
# default is 512kB on linux, 0 otherwise
# - Asynchronous Behavior -
postgresql_effective_io_concurrency: 1 # 1-1000; 0 disables prefetching
postgresql_max_worker_processes: 8 # (change requires restart)
postgresql_max_parallel_workers_per_gather: 0 # (>= 9.6) taken from max_worker_processes
postgresql_max_parallel_workers: 8 # (>= 10)
postgresql_old_snapshot_threshold: -1 # (>= 9.6) 1min-60d; -1 disables; 0 is immediate
# (change requires restart)
postgresql_backend_flush_after: 0 # (>= 9.6) 0 disables, default is 0
#------------------------------------------------------------------------------
# WRITE AHEAD LOG
#------------------------------------------------------------------------------
# - Settings -
postgresql_wal_level: "minimal" # minimal, archive (<= 9.5), hot_standby (<= 9.5), replica (>= 9.6), or logical
postgresql_fsync: on # flush data to disk for crash safety
# (turning this off can cause
# unrecoverable data corruption)
# Synchronization level:
# - off
# - local
# - remote_write
# - remote_apply (>= 9.6)
# - on
postgresql_synchronous_commit: "on"
# The default is the first option supported by the operating system:
# - open_datasync
# - fdatasync (default on Linux)
# - fsync
# - fsync_writethrough
# - open_sync
postgresql_wal_sync_method: "fsync"
# recover from partial page writes
postgresql_full_page_writes: on
postgresql_wal_compression: off # (>= 9.5)
postgresql_wal_log_hints: off # also do full page writes of non-critical updates
postgresql_wal_buffers: -1 # min 32kB, -1 sets based on shared_buffers
postgresql_wal_writer_delay: 200ms # 1-10000 milliseconds
postgresql_wal_writer_flush_after: 1MB # (>= 9.6) 0 disables
postgresql_commit_delay: 0 # range 0-100000, in microseconds
postgresql_commit_siblings: 5 # range 1-1000
# - Checkpoints -
postgresql_checkpoint_segments: 3 # (<= 9.4) in logfile segments, min 1, 16MB each
postgresql_max_wal_size: 1GB # (>= 9.5)
postgresql_min_wal_size: 80MB # (>= 9.5)
postgresql_checkpoint_flush_after: 0 # (>= 9.6) 0 disables,
# default is 256kB on linux, 0 otherwise
postgresql_checkpoint_timeout: 5min # range 30s-1d
postgresql_checkpoint_completion_target: 0.5 # checkpoint target duration, 0.0 - 1.0
postgresql_checkpoint_warning: 30s # 0 disables
# - Archiving -
# allows archiving to be done
postgresql_archive_mode: off # Should be a string with quotes, but all templates need fixing first
# Command to use to archive a logfile segment.
# Placeholders: %p = path of file to archive
# %f = file name only
# e.g. 'test ! -f /mnt/server/archivedir/%f && cp %p /mnt/server/archivedir/%f'
postgresql_archive_command: ""
# force a logfile segment switch after this
postgresql_archive_timeout: 0
#------------------------------------------------------------------------------
# REPLICATION
#------------------------------------------------------------------------------
# - Sending Server(s) -
# Set these on the master and on any standby that will send replication data.
# max number of walsender processes
postgresql_max_wal_senders: 0
postgresql_wal_sender_delay: 1s # walsender cycle time, 1-10000 milliseconds (<= 9.1)
postgresql_wal_keep_segments: 0 # in logfile segments, 16MB each; 0 disables
postgresql_replication_timeout: 60s # in milliseconds; 0 disables (<= 9.2)
postgresql_wal_sender_timeout: 60s # in milliseconds; 0 disables (>= 9.3)
postgresql_max_replication_slots: 0 # max number of replication slots
postgresql_track_commit_timestamp: off # (>= 9.5)
# - Master Server -
# These settings are ignored on a standby server.
# standby servers that provide sync rep.
# number of sync standbys (>= 9.6) and comma-separated list of application_name from standby(s)
postgresql_synchronous_standby_num_sync: "" # >= 9.6 (NOTE: If you use the ANY/ALL syntax in v10, then note the new variable below)
postgresql_synchronous_standby_choose_sync: "FIRST" # >= 10
postgresql_synchronous_standby_names: [] # '*' means 'all'
# number of xacts by which cleanup is delayed
postgresql_vacuum_defer_cleanup_age: 0
# - Standby Servers -
# "on" allows queries during recovery
postgresql_hot_standby: off
# max delay before canceling queries when reading WAL from archive
postgresql_max_standby_archive_delay: 30s # -1 allows indefinite delay
# max delay before canceling queries when reading streaming WAL;
postgresql_max_standby_streaming_delay: 30s # -1 allows indefinite delay
# send replies at least this often
postgresql_wal_receiver_status_interval: 10s # 0 disables
# send info from standby to prevent query conflicts
postgresql_hot_standby_feedback: off
#time that receiver waits for communication from master in milliseconds
postgresql_wal_receiver_timeout: 60s
# time to wait before retrying to retrieve WAL after a failed attempt
postgresql_wal_retrieve_retry_interval: 5s # (>= 9.5)
# - Subscribers - (>= 10)
# These settings are ignored on a publisher.
postgresql_max_logical_replication_workers: 4 # (>= 10) taken from max_worker_processes
# (change requires restart)
postgresql_max_sync_workers_per_subscription: 2 # (>= 10) taken from max_logical_replication_workers
#------------------------------------------------------------------------------
# QUERY TUNING
#------------------------------------------------------------------------------
# - Planner Method Configuration -
postgresql_enable_bitmapscan: on
postgresql_enable_hashagg: on
postgresql_enable_hashjoin: on
postgresql_enable_indexscan: on
postgresql_enable_indexonlyscan: on
postgresql_enable_material: on
postgresql_enable_mergejoin: on
postgresql_enable_nestloop: on
postgresql_enable_seqscan: on
postgresql_enable_sort: on
postgresql_enable_tidscan: on
# - Planner Cost Constants -
postgresql_seq_page_cost: 1.0 # measured on an arbitrary scale
postgresql_random_page_cost: 4.0 # same scale as above
postgresql_cpu_tuple_cost: 0.01 # same scale as above
postgresql_cpu_index_tuple_cost: 0.005 # same scale as above
postgresql_cpu_operator_cost: 0.0025 # same scale as above
postgresql_parallel_tuple_cost: 0.1 # same scale as above (>= 9.6)
postgresql_parallel_setup_cost: 1000.0 # same scale as above (>= 9.6)
postgresql_min_parallel_relation_size: 8MB # (= 9.6) replaced by below two parameters in 10
postgresql_min_parallel_table_scan_size: 8MB # (>= 10)
postgresql_min_parallel_index_scan_size: 512kB # (>= 10)
postgresql_effective_cache_size: 128MB
# - Genetic Query Optimizer -
postgresql_geqo: on
postgresql_geqo_threshold: 12
postgresql_geqo_effort: 5 # range 1-10
postgresql_geqo_pool_size: 0 # selects default based on effort
postgresql_geqo_generations: 0 # selects default based on effort
postgresql_geqo_selection_bias: 2.0 # range 1.5-2.0
postgresql_geqo_seed: 0.0 # range 0.0-1.0
# - Other Planner Options -
postgresql_default_statistics_target: 100 # range 1-10000
postgresql_constraint_exclusion: "partition" # on, off, or partition
postgresql_cursor_tuple_fraction: 0.1 # range 0.0-1.0
postgresql_from_collapse_limit: 8
postgresql_join_collapse_limit: 8 # 1 disables collapsing of explicit
postgresql_force_parallel_mode: "off" # (>= 9.6)
#------------------------------------------------------------------------------
# ERROR REPORTING AND LOGGING
#------------------------------------------------------------------------------
# - Where to Log -
# Valid values are combinations of stderr, csvlog, syslog, and eventlog.
# depending on platform. Csvlog requires logging_collector to be on.
postgresql_log_destination: "stderr"
# Enable capturing of stderr and csvlog into log files.
# Required to be on for csvlogs.
postgresql_logging_collector: off
# These are only used if logging_collector is on:
# Directory where log files are written, can be absolute or relative to PGDATA
postgresql_log_directory: "pg_log"
# Log file name pattern, can include strftime() escapes
postgresql_log_filename: "postgresql-%Y-%m-%d_%H%M%S.log"
postgresql_log_file_mode: "0600" # begin with 0 to use octal notation
# If on, an existing log file with the same name as the new log file will be
# truncated rather than appended to. But such truncation only occurs on
# time-driven rotation, not on restarts or size-driven rotation. Default is
# off, meaning append to existing files in all cases.
postgresql_log_truncate_on_rotation: off
# Automatic rotation of logfiles will happen after that time.
postgresql_log_rotation_age: 1d
# Automatic rotation of logfiles will happen after that much log output.
postgresql_log_rotation_size: 10MB
# These are relevant when logging to syslog:
postgresql_syslog_facility: "LOCAL0"
postgresql_syslog_ident: "postgres"
postgresql_syslog_sequence_numbers: on # (>= 9.6)
postgresql_syslog_split_messages: on # (>= 9.6)
# This is only relevant when logging to eventlog (win32) (>= 9.2):
postgresql_event_source: "PostgreSQL"
# - When to Log -
# Values in order of decreasing detail:
# - debug5
# - debug4
# - debug3
# - debug2
# - debug1
# - log
# - notice
# - warning
# - error
postgresql_client_min_messages: "notice"
# Values in order of decreasing detail:
# - debug5
# - debug4
# - debug3
# - debug2
# - debug1
# - info
# - notice
# - warning
# - error
# - log
# - fatal
# - panic
postgresql_log_min_messages: "warning"
# Values in order of decreasing detail:
# - debug5
# - debug4
# - debug3
# - debug2
# - debug1
# - info
# - notice
# - warning
# - error
# - log
# - fatal
# - panic (effectively off)
postgresql_log_min_error_statement: "error"
# -1 is disabled, 0 logs all statements and their durations, > 0 logs only
# statements running at least this number of milliseconds
postgresql_log_min_duration_statement: -1
# - What to Log -
postgresql_debug_print_parse: off
postgresql_debug_print_rewritten: off
postgresql_debug_print_plan: off
postgresql_debug_pretty_print: on
postgresql_log_checkpoints: off
postgresql_log_connections: off
postgresql_log_disconnections: off
postgresql_log_duration: off
postgresql_log_error_verbosity: "default" # terse, default, or verbose messages
postgresql_log_hostname: off
# Special values:
# %a = application name
# %u = user name
# %d = database name
# %r = remote host and port
# %h = remote host
# %p = process ID
# %t = timestamp without milliseconds
# %m = timestamp with milliseconds
# %n = timestamp with milliseconds (as a Unix epoch)
# %i = command tag
# %e = SQL state
# %c = session ID
# %l = session line number
# %s = sessioan start timestamp
# %v = virtual transaction ID
# %x = transaction ID (0 if none)
# %q = stop here in non-session
# processes
# %% = '%'
postgresql_log_line_prefix: "%t "
# log lock waits >= deadlock_timeout
postgresql_log_lock_waits: off
postgresql_log_statement: "none" # none, ddl, mod, all
postgresql_log_replication_commands: off
# log temporary files equal or larger
postgresql_log_temp_files: -1
postgresql_log_timezone: "UTC"
#------------------------------------------------------------------------------
# RUNTIME STATISTICS
#------------------------------------------------------------------------------
# - Query/Index Statistics Collector -
postgresql_track_activities: on
postgresql_track_counts: on
postgresql_track_io_timing: off # (>= 9.2)
postgresql_track_functions: "none" # none, pl, all
postgresql_track_activity_query_size: 1024
postgresql_update_process_title: on
postgresql_stats_temp_directory: "pg_stat_tmp"
# - Statistics Monitoring -
postgresql_log_parser_stats: off
postgresql_log_planner_stats: off
postgresql_log_executor_stats: off
postgresql_log_statement_stats: off
#------------------------------------------------------------------------------
# AUTOVACUUM PARAMETERS
#------------------------------------------------------------------------------
# Enable autovacuum subprocess? 'on' requires track_counts to also be on.
postgresql_autovacuum: on
# -1 disables, 0 logs all actions and their durations, > 0 logs only
# actions running at least this number of milliseconds.
postgresql_log_autovacuum_min_duration: -1
# max number of autovacuum subprocesses
postgresql_autovacuum_max_workers: 3
# time between autovacuum runs
postgresql_autovacuum_naptime: 1min
# min number of row updates before vacuum
postgresql_autovacuum_vacuum_threshold: 50
# min number of row updates before analyze
postgresql_autovacuum_analyze_threshold: 50
# fraction of table size before vacuum
postgresql_autovacuum_vacuum_scale_factor: 0.2
# fraction of table size before analyze
postgresql_autovacuum_analyze_scale_factor: 0.1
# maximum XID age before forced vacuum
postgresql_autovacuum_freeze_max_age: 200000000
# maximum Multixact age before forced vacuum (>= 9.3)
postgresql_autovacuum_multixact_freeze_max_age: 400000000
# default vacuum cost delay for autovacuum, in milliseconds
postgresql_autovacuum_vacuum_cost_delay: 20ms
# default vacuum cost limit for autovacuum,
postgresql_autovacuum_vacuum_cost_limit: -1
#------------------------------------------------------------------------------
# CLIENT CONNECTION DEFAULTS
#------------------------------------------------------------------------------
# - Statement Behavior -
postgresql_search_path: # schema names
- '"$user"'
- "public"
postgresql_default_tablespace: "" # a tablespace name, "" uses the default
postgresql_temp_tablespaces: [] # a list of tablespace names
postgresql_check_function_bodies: on
postgresql_default_transaction_isolation: "read committed"
postgresql_default_transaction_read_only: off
postgresql_default_transaction_deferrable: off
postgresql_session_replication_role: "origin"
postgresql_statement_timeout: 0 # in milliseconds, 0 is disabled
postgresql_lock_timeout: 0 # in milliseconds, 0 is disabled (>= 9.3)
postgresql_idle_in_transaction_session_timeout: 0 # in milliseconds, 0 is disabled (>= 9.6)
postgresql_vacuum_freeze_min_age: 50000000
postgresql_vacuum_freeze_table_age: 150000000
postgresql_vacuum_multixact_freeze_min_age: 5000000 # (>= 9.3)
postgresql_vacuum_multixact_freeze_table_age: 150000000 # (>= 9.3)
postgresql_bytea_output: "hex" # hex, escape
postgresql_xmlbinary: "base64"
postgresql_xmloption: "content"
postgresql_gin_fuzzy_search_limit: 0 # (<= 9.2)
postgresql_gin_pending_list_limit: 4MB # (>= 9.5)
# - Locale and Formatting -
postgresql_datestyle:
- "iso"
- "mdy"
postgresql_intervalstyle: "postgres"
postgresql_timezone: "UTC"
# Select the set of available time zone abbreviations. Currently, there are:
# Default
# Australia
# India
# You can create your own file in `share/timezonesets/`.
postgresql_timezone_abbreviations: "Default"
postgresql_extra_float_digits: 0 # min -15, max 3
postgresql_client_encoding: False # actually defaults to database encoding
# 'sql_ascii', 'UTF8', ...
# These settings are initialized by initdb, but they can be changed.
# locale for system error message
postgresql_lc_messages: "{{ postgresql_locale }}"
# locale for monetary formatting
postgresql_lc_monetary: "{{ postgresql_locale }}"
# locale for number formatting
postgresql_lc_numeric: "{{ postgresql_locale }}"
# locale for time formatting
postgresql_lc_time: "{{ postgresql_locale }}"
postgresql_default_text_search_config: "pg_catalog.english"
postgresql_dynamic_library_path: "$libdir"
postgresql_local_preload_libraries: []
postgresql_session_preload_libraries: []
#------------------------------------------------------------------------------
# LOCK MANAGEMENT
#------------------------------------------------------------------------------
postgresql_deadlock_timeout: 1s
postgresql_max_locks_per_transaction: 64 # min 10
# Note: Each lock table slot uses ~270 bytes of shared memory, and there are
# max_locks_per_transaction * (max_connections + max_prepared_transactions)
# lock table slots.
postgresql_max_pred_locks_per_transaction: 64 # min 10
postgresql_max_pred_locks_per_relation: -2 # (>= 10) negative values mean
# (max_pred_locks_per_transaction
# / -max_pred_locks_per_relation) - 1
postgresql_max_pred_locks_per_page: 2 # (>= 10) min 0
#------------------------------------------------------------------------------
# VERSION/PLATFORM COMPATIBILITY
#------------------------------------------------------------------------------
# - Previous PostgreSQL Versions -
postgresql_array_nulls: on
postgresql_backslash_quote: "safe_encoding" # on, off, or safe_encoding
postgresql_default_with_oids: off
postgresql_escape_string_warning: on
postgresql_lo_compat_privileges: off
postgresql_quote_all_identifiers: off
postgresql_sql_inheritance: on
postgresql_standard_conforming_strings: on
postgresql_synchronize_seqscans: on
# - Other Platforms and Clients -
postgresql_transform_null_equals: off
#------------------------------------------------------------------------------
# ERROR HANDLING
#------------------------------------------------------------------------------
# Terminate session on any error?
postgresql_exit_on_error: off
# Reinitialize after backend crash?
postgresql_restart_after_crash: on
#------------------------------------------------------------------------------
# PGTUNE
#------------------------------------------------------------------------------
# Should we run pgtune and accept the changes it proposes?
postgresql_pgtune: no
# Total system memory in bytes, will attempt to detect if set to "no"
postgresql_pgtune_memory: no
# Database type, valid options are DW, OLTP, Web, Mixed, Desktop
postgresql_pgtune_type: "Mixed"
# Maximum number of expected connections, if "no", default based on db type
postgresql_pgtune_connections: no
postgresql_env:
LC_ALL: "{{ postgresql_locale }}"
LC_LCTYPE: "{{ postgresql_locale }}"
# Install repo, or rely on existing configuration (Satellite, Artifactory, etc.)
postgresql_install_repository: true
# APT settings
postgresql_apt_key_id: "ACCC4CF8"
postgresql_apt_key_url: "https://www.postgresql.org/media/keys/ACCC4CF8.asc"
postgresql_apt_repository: "deb http://apt.postgresql.org/pub/repos/apt/ {{ ansible_distribution_release }}-pgdg main {{ postgresql_version }}"
# Pin-Priority of PGDG repository
postgresql_apt_pin_priority: 500
# Yum settings
postgresql_pgdg_dists:
RedHat: redhat
CentOS: centos
Scientific: sl
SLC: sl
OracleLinux: oraclelinux
Fedora: fedora
postgresql_pgdg_releases:
redhat: {
9.1: 8,
9.2: 9,
9.3: 3,
9.4: 3,
9.5: 3,
9.6: 3,
10: 2,
}
centos: {
9.1: 7,
9.2: 8,
9.3: 3,
9.4: 3,
9.5: 3,
9.6: 3,
10: 2,
}
sl: {
9.1: 8,
9.2: 9,
9.3: 3,
9.4: 3,
9.5: 3,
9.6: 3,
10: 2,
}
oraclelinux: {
9.1: 8,
9.2: 9,
9.3: 3,
9.4: 3,
9.5: 3,
9.6: 3,
10: 2,
}
postgresql_fedora_releases:
fedora: {
9.5: 12,
9.6: 8,
10: 3,
11: 1,
}
postgresql_version_terse: "{{ postgresql_version | replace('.', '') }}"
# YUM repository locations
postgresql_yum_repository_url: "http://yum.postgresql.org"
postgresql_pgdg_repository_url: "https://download.postgresql.org/pub/repos/yum/"
# YUM (RedHat, CentOS, etc.) baseurl/gpgkey
postgresql_yum_repository_baseurl: "{{ postgresql_yum_repository_url }}/{{ postgresql_version }}/{{ ansible_os_family | lower }}/rhel-{{ ansible_distribution_major_version }}-{{ ansible_architecture }}"
postgresql_yum_repository_gpgkey: "{{ postgresql_pgdg_repository_url }}/RPM-GPG-KEY-PGDG-{{ postgresql_version_terse }}"
# DNF (Fedora) baseurl/gpgkey
postgresql_dnf_repository_baseurl: "{{ postgresql_yum_repository_url }}/{{ postgresql_version }}/fedora/fedora-{{ ansible_distribution_major_version }}-{{ ansible_architecture }}"
postgresql_dnf_repository_gpgkey: "{{ postgresql_yum_repository_gpgkey }}"
postgresql_apt_py3_dependencies: ["python3-psycopg2", "locales"]
postgresql_apt_py2_dependencies: ["python-psycopg2", "python-pycurl", "locales"]
postgresql_apt_dependencies: "{{ postgresql_apt_py3_dependencies if 'python3' in ansible_python_interpreter|default('') else postgresql_apt_py2_dependencies }}"