Skip to content

Commit

Permalink
add stats_temp_directory variables
Browse files Browse the repository at this point in the history
postgresql_stats_temp_directory_path
postgresql_stats_temp_directory_size

#54
  • Loading branch information
vitabaks committed Aug 17, 2020
1 parent c386e43 commit 3be08fc
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 4 deletions.
12 changes: 9 additions & 3 deletions roles/patroni/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -313,18 +313,24 @@

- name: Prepare PostgreSQL | create statistics directory (if not already exists)
file:
path: /var/lib/pgsql_stats_tmp
path: "{{ postgresql_stats_temp_directory_path }}"
state: directory
mode: 01777
when:
- postgresql_stats_temp_directory_path is defined
- postgresql_stats_temp_directory_path != 'none'
tags: patroni, pgsql_stats_tmp

- name: Prepare PostgreSQL | mount the statistics directory in memory (tmpfs)
mount:
path: /var/lib/pgsql_stats_tmp
path: "{{ postgresql_stats_temp_directory_path }}"
src: tmpfs
fstype: tmpfs
opts: "size=1024m,uid=postgres,gid=postgres"
opts: "size={{ postgresql_stats_temp_directory_size }},uid=postgres,gid=postgres"
state: mounted
when:
- postgresql_stats_temp_directory_path is defined
- postgresql_stats_temp_directory_path != 'none'
tags: patroni, pgsql_stats_tmp

- name: Prepare PostgreSQL | make sure the postgresql log directory "{{ postgresql_log_dir }}" exists
Expand Down
4 changes: 3 additions & 1 deletion roles/patroni/templates/patroni.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,9 @@ postgresql:
# password: rewind_password
parameters:
unix_socket_directories: {{ postgresql_unix_socket_dir }}
stats_temp_directory: /var/lib/pgsql_stats_tmp
{% if postgresql_stats_temp_directory_path is defined and postgresql_stats_temp_directory_path != 'none' %}
stats_temp_directory: {{ postgresql_stats_temp_directory_path }}
{% endif %}

remove_data_directory_on_rewind_failure: {{ patroni_remove_data_directory_on_rewind_failure |string |d(false, true) |lower }}
remove_data_directory_on_diverged_timelines: {{ patroni_remove_data_directory_on_diverged_timelines |string |d(false, true) |lower }}
Expand Down
4 changes: 4 additions & 0 deletions vars/Debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ postgresql_unix_socket_dir: "/var/run/postgresql"
postgresql_home_dir: "/var/lib/postgresql"
postgresql_pgpass: "{{ postgresql_home_dir }}/.pgpass"

# stats_temp_directory (mount the statistics directory in tmpfs)
postgresql_stats_temp_directory_path: "/var/lib/pgsql_stats_tmp" # or 'none'
postgresql_stats_temp_directory_size: "1024m"

postgresql_version_terse: "{{ postgresql_version | replace('.', '') }}"

# Repository
Expand Down
4 changes: 4 additions & 0 deletions vars/RedHat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ postgresql_unix_socket_dir: "/var/run/postgresql"
postgresql_home_dir: "/var/lib/pgsql"
postgresql_pgpass: "{{ postgresql_home_dir }}/.pgpass"

# stats_temp_directory (mount the statistics directory in tmpfs)
postgresql_stats_temp_directory_path: "/var/lib/pgsql_stats_tmp" # or 'none'
postgresql_stats_temp_directory_size: "1024m"

postgresql_version_terse: "{{ postgresql_version | replace('.', '') }}"

# Repository
Expand Down

0 comments on commit 3be08fc

Please sign in to comment.