forked from ISTI-ansible-roles/ansible-roles
postgresql: Use different tasks to configure the logging system and the autovacuum.
This commit is contained in:
parent
cf4c3d56cc
commit
7d9b24174a
|
@ -31,6 +31,34 @@ psql_conf_parameters:
|
|||
- { name: 'max_stack_depth', value: '2MB', set: 'False' }
|
||||
- { name: 'max_files_per_process', value: '1000', set: 'False' }
|
||||
|
||||
# logging configuration. Important: the parameters that need a restart must be listed in psql_conf_parameters
|
||||
psql_log_configuration:
|
||||
- { name: 'log_destination', value: 'stderr', set: 'True' }
|
||||
- { name: 'logging_collector', value: 'off', set: 'False' }
|
||||
- { name: 'log_directory', value: '{{ psql_log_dir }}', set: 'True' }
|
||||
- { name: 'log_rotation_age', value: '1d', set: 'True' }
|
||||
- { name: 'log_rotation_size', value: '10MB', set: 'True' }
|
||||
- { name: 'client_min_messages', value: 'notice', set: 'True' }
|
||||
- { name: 'log_min_messages', value: 'warning', set: 'True' }
|
||||
- { name: 'log_min_error_statement', value: 'error', set: 'True' }
|
||||
- { name: 'log_min_duration_statement', value: '-1', set: 'True' }
|
||||
- { name: 'log_checkpoints', value: 'off', set: 'True' }
|
||||
- { name: 'log_connections', value: 'on', set: 'True' }
|
||||
- { name: 'log_disconnections', value: 'off', set: 'True' }
|
||||
- { name: 'log_duration', value: 'off', set: 'True' }
|
||||
- { name: 'log_error_verbosity', value: 'default', set: 'True' }
|
||||
- { name: 'log_hostname', value: 'on', set: 'True' }
|
||||
|
||||
# Treat vacuum separately. Important: the parameters that need a restart must be listed in psql_conf_parameters
|
||||
psql_autovacuum_configuration:
|
||||
- { name: 'track_counts', value: 'on', set: 'True' }
|
||||
- { name: 'autovacuum', value: 'on', set: 'True' }
|
||||
- { name: 'log_autovacuum_min_duration', value: '-1', set: 'True' }
|
||||
- { name: 'autovacuum_vacuum_threshold', value: '50', set: 'True' }
|
||||
- { name: 'autovacuum_analyze_threshold', value: '50', set: 'True' }
|
||||
- { name: 'autovacuum_vacuum_scale_factor', value: '0.2', set: 'True' }
|
||||
- { name: 'autovacuum_vacuum_cost_limit', value: '1000', set: 'True' }
|
||||
|
||||
# SSL as a special case
|
||||
psql_enable_ssl: False
|
||||
psql_force_ssl_client_connection: False
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
when: psql_use_alternate_data_dir
|
||||
tags: [ 'postgresql', 'postgres', 'pg_conf' ]
|
||||
|
||||
- name: Set some postgresql configuration parameters
|
||||
- name: Set some postgresql configuration parameters that require a db restart
|
||||
become: True
|
||||
become_user: postgres
|
||||
action: configfile path={{ psql_conf_dir }}/postgresql.conf key={{ item.name }} value="{{ item.value }}"
|
||||
|
@ -21,3 +21,21 @@
|
|||
notify: Restart postgresql
|
||||
tags: [ 'postgresql', 'postgres', 'pg_conf' ]
|
||||
|
||||
- name: Set the postgresql logging configuration parameters
|
||||
become: True
|
||||
become_user: postgres
|
||||
action: configfile path={{ psql_conf_dir }}/postgresql.conf key={{ item.name }} value="{{ item.value }}"
|
||||
with_items: '{{ psql_log_parameters }}'
|
||||
when: item.set == 'True'
|
||||
notify: Reload postgresql
|
||||
tags: [ 'postgresql', 'postgres', 'pg_conf', 'pg_conf_log' ]
|
||||
|
||||
- name: Set the postgresql autovacuum configuration parameters
|
||||
become: True
|
||||
become_user: postgres
|
||||
action: configfile path={{ psql_conf_dir }}/postgresql.conf key={{ item.name }} value="{{ item.value }}"
|
||||
with_items: '{{ psql_autovacuum_parameters }}'
|
||||
when: item.set == 'True'
|
||||
notify: Reload postgresql
|
||||
tags: [ 'postgresql', 'postgres', 'pg_conf', 'pg_autovacuum_log' ]
|
||||
|
||||
|
|
Loading…
Reference in New Issue