Skip to content

Commit

Permalink
Allow "archive_mode" to be on/off, or on/off/always >=9.5
Browse files Browse the repository at this point in the history
Handle the new archive_mode option in v9.5 gracefully on all versions
  • Loading branch information
gclough authored Mar 7, 2019
1 parent f47bdff commit b615da1
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ 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
postgresql_archive_mode: "off"

# Command to use to archive a logfile segment.
# Placeholders: %p = path of file to archive
Expand Down
2 changes: 1 addition & 1 deletion templates/postgresql.conf-10.j2
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ checkpoint_warning = {{postgresql_checkpoint_warning}} # 0 disables

# - Archiving -

archive_mode = {{'on' if postgresql_archive_mode else 'off'}} # enables archiving; off, on, or always
archive_mode = {{ 'on' if ( postgresql_archive_mode|bool == true or postgresql_archive_mode == 'on' ) else ( 'always' if postgresql_archive_mode == 'always' else 'off' ) }} # enables archiving; off, on, or always
# (change requires restart)
archive_command = '{{postgresql_archive_command}}' # command to use to archive a logfile segment
# placeholders: %p = path of file to archive
Expand Down
2 changes: 1 addition & 1 deletion templates/postgresql.conf-9.1.j2
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ checkpoint_warning = {{postgresql_checkpoint_warning}} # 0 disables

# - Archiving -

archive_mode = {{'on' if postgresql_archive_mode else 'off'}} # allows archiving to be done
archive_mode = {{ 'on' if ( postgresql_archive_mode|bool == true or postgresql_archive_mode == 'on' ) else 'off' }} # allows archiving to be done
# (change requires restart)
archive_command = '{{postgresql_archive_command}}' # command to use to archive a logfile segment
archive_timeout = {{postgresql_archive_timeout}} # force a logfile segment switch after this
Expand Down
2 changes: 1 addition & 1 deletion templates/postgresql.conf-9.2.j2
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ checkpoint_warning = {{postgresql_checkpoint_warning}} # 0 disables

# - Archiving -

archive_mode = {{'on' if postgresql_archive_mode else 'off'}} # allows archiving to be done
archive_mode = {{ 'on' if ( postgresql_archive_mode|bool == true or postgresql_archive_mode == 'on' ) else 'off' }} # allows archiving to be done
# (change requires restart)
archive_command = '{{postgresql_archive_command}}' # command to use to archive a logfile segment
# placeholders: %p = path of file to archive
Expand Down
2 changes: 1 addition & 1 deletion templates/postgresql.conf-9.3.j2
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ checkpoint_warning = {{postgresql_checkpoint_warning}} # 0 disables

# - Archiving -

archive_mode = {{'on' if postgresql_archive_mode else 'off'}} # allows archiving to be done
archive_mode = {{ 'on' if ( postgresql_archive_mode|bool == true or postgresql_archive_mode == 'on' ) else 'off' }} # allows archiving to be done
# (change requires restart)
archive_command = '{{postgresql_archive_command}}' # command to use to archive a logfile segment
# placeholders: %p = path of file to archive
Expand Down
2 changes: 1 addition & 1 deletion templates/postgresql.conf-9.4.j2
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ checkpoint_warning = {{postgresql_checkpoint_warning}} # 0 disables

# - Archiving -

archive_mode = {{'on' if postgresql_archive_mode else 'off'}} # allows archiving to be done
archive_mode = {{ 'on' if ( postgresql_archive_mode|bool == true or postgresql_archive_mode == 'on' ) else 'off' }} # allows archiving to be done
# (change requires restart)
archive_command = '{{postgresql_archive_command}}' # command to use to archive a logfile segment
# placeholders: %p = path of file to archive
Expand Down
3 changes: 2 additions & 1 deletion templates/postgresql.conf-9.5.j2
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,8 @@ checkpoint_warning = {{postgresql_checkpoint_warning}} # 0 disables

# - Archiving -

archive_mode = {{'on' if postgresql_archive_mode else 'off'}} # enables archiving; off, on, or always
archive_mode = {{ 'on' if ( postgresql_archive_mode|bool == true or postgresql_archive_mode == 'on' ) else ( 'always' if postgresql_archive_mode == 'always' else 'off' ) }} # enables archiving; off, on, or always
# (change requires restart)
archive_command = '{{postgresql_archive_command}}' # command to use to archive a logfile segment
# placeholders: %p = path of file to archive
# %f = file name only
Expand Down
3 changes: 2 additions & 1 deletion templates/postgresql.conf-9.6.j2
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,8 @@ checkpoint_warning = {{postgresql_checkpoint_warning}} # 0 disables

# - Archiving -

archive_mode = {{'on' if postgresql_archive_mode else 'off'}} # enables archiving; off, on, or always
archive_mode = {{ 'on' if ( postgresql_archive_mode|bool == true or postgresql_archive_mode == 'on' ) else ( 'always' if postgresql_archive_mode == 'always' else 'off' ) }} # enables archiving; off, on, or always
# (change requires restart)
archive_command = '{{postgresql_archive_command}}' # command to use to archive a logfile segment
# placeholders: %p = path of file to archive
# %f = file name only
Expand Down

0 comments on commit b615da1

Please sign in to comment.