Skip to content
14 changes: 8 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@ env:
- ROLE_OPTIONS="postgresql_version=9.3" ANSIBLE_VERSION="1.9.4"
- ROLE_OPTIONS="postgresql_version=9.4" ANSIBLE_VERSION="1.9.4"
- ROLE_OPTIONS="postgresql_version=9.5" ANSIBLE_VERSION="1.9.4"
- ROLE_OPTIONS="postgresql_version=9.1" ANSIBLE_VERSION="2.0.0.2"
- ROLE_OPTIONS="postgresql_version=9.2" ANSIBLE_VERSION="2.0.0.2"
- ROLE_OPTIONS="postgresql_version=9.3" ANSIBLE_VERSION="2.0.0.2"
- ROLE_OPTIONS="postgresql_version=9.4" ANSIBLE_VERSION="2.0.0.2"
- ROLE_OPTIONS="postgresql_version=9.5" ANSIBLE_VERSION="2.0.0.2"
- ROLE_OPTIONS="postgresql_version=9.6" ANSIBLE_VERSION="1.9.4"
- ROLE_OPTIONS="postgresql_version=9.1" ANSIBLE_VERSION="2.1.2.0"
- ROLE_OPTIONS="postgresql_version=9.2" ANSIBLE_VERSION="2.1.2.0"
- ROLE_OPTIONS="postgresql_version=9.3" ANSIBLE_VERSION="2.1.2.0"
- ROLE_OPTIONS="postgresql_version=9.4" ANSIBLE_VERSION="2.1.2.0"
- ROLE_OPTIONS="postgresql_version=9.5" ANSIBLE_VERSION="2.1.2.0"
- ROLE_OPTIONS="postgresql_version=9.6" ANSIBLE_VERSION="2.1.2.0"

before_install:
# Remove the PostgreSQL installed by Travis
Expand Down Expand Up @@ -50,4 +52,4 @@ script:

# Testing with docker (experimental)
- docker build -f tests/Dockerfile-ubuntu14.04 -t postgres_ubuntu14.04 .
- docker build -f tests/Dockerfile-centos6 -t postgres_centos6 .
- docker build -f tests/Dockerfile-centos6 -t postgres_centos6 .
189 changes: 121 additions & 68 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -141,16 +141,15 @@ postgresql_shared_buffers: 128MB # min 128kB
postgresql_huge_pages: try # on, off, or try
postgresql_temp_buffers: 8MB # min 800kB

# Note: Increasing max_prepared_transactions costs ~600 bytes of shared memory
# per transaction slot, plus lock space (see max_locks_per_transaction).
# It is not advisable to set max_prepared_transactions nonzero unless you
# actively intend to use prepared transactions.
# 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_autovacuum_work_mem: -1 # min 1MB, or -1 to use maintenance_work_mem
postgresql_max_stack_depth: 2MB # min 100kB
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
Expand All @@ -162,7 +161,7 @@ postgresql_dynamic_shared_memory_type: posix # the default is the first optio

# - Disk -

# limits per-session temp file space in kB, or -1 for no limit (>= 9.2)
# limits per-process temp file space in kB, or -1 for no limit (>= 9.2)
postgresql_temp_file_limit: -1


Expand All @@ -185,13 +184,19 @@ postgresql_vacuum_cost_limit: 200 # 1-10000 credits

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 multipler on buffers scanned/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
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_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


#------------------------------------------------------------------------------
Expand All @@ -200,13 +205,16 @@ postgresql_max_worker_processes: 8

# - Settings -

postgresql_wal_level: minimal # minimal, archive, hot_standby, or logical
postgresql_fsync: on # turns forced synchronization on or off
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"

Expand All @@ -223,18 +231,21 @@ 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_commit_delay: 0 # range 0-100000, in microseconds
postgresql_commit_siblings: 5 # range 1-1000
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_timeout: 5min # range 30s-1h
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

Expand Down Expand Up @@ -277,8 +288,9 @@ postgresql_track_commit_timestamp: off # (>= 9.5)

# These settings are ignored on a standby server.

# Standby servers that provide sync rep.
# Comma-separated list of application_name from standby(s)
# 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: 1
postgresql_synchronous_standby_names: [] # '*' means 'all'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would make sense to add '*' as default value?


# number of xacts by which cleanup is delayed
Expand Down Expand Up @@ -308,47 +320,51 @@ postgresql_wal_retrieve_retry_interval: 5s # (>= 9.5)

# - 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
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_effective_cache_size: 128MB
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)
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
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_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)


#------------------------------------------------------------------------------
Expand All @@ -359,34 +375,36 @@ postgresql_join_collapse_limit: 8 # 1 disables collapsing of expl

# Valid values are combinations of stderr, csvlog, syslog, and eventlog.
# depending on platform. Csvlog requires logging_collector to be on.
postgresql_log_destination: stderr
postgresql_log_destination: stderr

# Enable capturing of stderr and csvlog into log files.
# Required to be on for csvlogs.
postgresql_logging_collector: off
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
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
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
postgresql_log_truncate_on_rotation: off
# Automatic rotation of logfiles will happen after that time.
postgresql_log_rotation_age: 1d
postgresql_log_rotation_age: 1d
# Automatic rotation of logfiles will happen after that much log output.
postgresql_log_rotation_size: 10MB
postgresql_log_rotation_size: 10MB

# These are relevant when logging to syslog:
postgresql_syslog_facility: LOCAL0
postgresql_syslog_ident: postgres
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
postgresql_event_source: PostgreSQL


# - When to Log -
Expand Down Expand Up @@ -460,6 +478,7 @@ postgresql_log_hostname: off
# %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
Expand Down Expand Up @@ -552,12 +571,13 @@ 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_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_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
Expand Down Expand Up @@ -680,6 +700,39 @@ postgresql_pgdg_dists:
Scientific: sl
SLC: sl
OracleLinux: oraclelinux
postgresql_pgdg_releases:
redhat: {
9.1: 8,
9.2: 9,
9.3: 3,
9.4: 3,
9.5: 3,
9.6: 3,
}
centos: {
9.1: 7,
9.2: 8,
9.3: 3,
9.4: 3,
9.5: 3,
9.6: 3,
}
sl: {
9.1: 8,
9.2: 9,
9.3: 3,
9.4: 3,
9.5: 3,
9.6: 3,
}
oraclelinux: {
9.1: 8,
9.2: 9,
9.3: 3,
9.4: 3,
9.5: 3,
9.6: 3,
}
postgresql_version_terse: "{{ postgresql_version | replace('.', '') }}"
postgresql_yum_repository_base_url: "http://yum.postgresql.org"
postgresql_yum_repository_url: "{{ postgresql_yum_repository_base_url }}/{{ postgresql_version }}/{{ ansible_os_family | lower }}/rhel-{{ ansible_distribution_major_version }}-{{ ansible_architecture }}/pgdg-{{ postgresql_pgdg_dists[ansible_distribution] }}{{ postgresql_version_terse }}-{{ postgresql_version }}-2.noarch.rpm"
postgresql_yum_repository_url: "{{ postgresql_yum_repository_base_url }}/{{ postgresql_version }}/{{ ansible_os_family | lower }}/rhel-{{ ansible_distribution_major_version }}-{{ ansible_architecture }}/pgdg-{{ postgresql_pgdg_dists[ansible_distribution] }}{{ postgresql_version_terse }}-{{ postgresql_version }}-{{ postgresql_pgdg_releases.get(postgresql_pgdg_dists[ansible_distribution]).get(postgresql_version) }}.noarch.rpm"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a fan of this approach, but it works better than using "-2.noarch.rpm" in all cases (especially since 9.6 does not have a '2' release for Red Hat).

Loading