Some configuration files must live in a file.

This commit is contained in:
Andrea Dell'Amico 2023-11-21 16:43:52 +01:00
parent 38bf87f9b1
commit fef9d8d002
Signed by: andrea.dellamico
GPG Key ID: 147ABE6CEB9E20FF
4 changed files with 34 additions and 5 deletions

View File

@ -14,14 +14,16 @@ timescale_db_el_pkgs:
- libpq5-devel
timescaledb_configuration_settings:
- { name: 'timescaledb.last_tuned', value: "'{{ ansible_date_time.date }}T{{ ansible_date_time.time }}{{ ansible_date_time.tz_offset }}'", set: 'True' }
# - { name: 'timescaledb.last_tuned_version', value: "'0.11.0'", set: 'True' }
- { name: 'timescaledb.max_background_workers', value: '{{ ansible_processor_vcpus * 8 }}', set: 'True' }
- { name: 'max_worker_processes', value: '{{ (ansible_processor_vcpus * 4) - 1 }}', set: 'True' }
- { name: 'max_parallel_workers_per_gather', value: '{{ (ansible_processor_vcpus / 2) | int }}', set: 'True' }
- { name: 'max_parallel_workers ', value: '{{ ansible_processor_vcpus }}', set: 'True' }
- { name: 'default_statistics_target', value: '{{ (ansible_memtotal_mb / 16) | int }}', set: 'True' }
- { name: 'random_page_cost', value: '1.1', set: 'True' }
- { name: 'checkpoint_completion_target', value: '0.9', set: 'True' }
- { name: 'max_locks_per_transaction', value: '{{ ((ansible_memtotal_mb / 512) * ansible_processor_vcpus) | int }}', set: 'True' }
- { name: 'effective_io_concurrency', value: '200', set: 'True' }
timescaledb_conf_settings_in_file:
- { name: 'timescaledb.last_tuned', value: "'{{ ansible_date_time.date }}T{{ ansible_date_time.time }}{{ ansible_date_time.tz_offset }}'", set: 'True' }
- { name: 'timescaledb.last_tuned_version', value: "'0.{{ timescaledb_postgresql_version }}.0'", set: 'True' }
- { name: 'timescaledb.max_background_workers', value: '{{ ansible_processor_vcpus * 8 }}', set: 'True' }
- { name: 'max_parallel_workers ', value: '{{ ansible_processor_vcpus }}', set: 'True' }

View File

@ -51,3 +51,11 @@
value: "{% if item.set %}{{ item.value }}{% else %}default{% endif %}"
loop: '{{ timescaledb_configuration_settings }}'
notify: Reload postgresql
- name: timescale_db_deb | Some settings must be written into a config file
become: true
become_user: postgres
ansible.builtin.template:
src: timescaledb.conf.j2
dest: "{{ psql_conf_dir }}/conf.d/timescaledb.conf"
mode: "0644"
notify: Restart postgresql

View File

@ -9,7 +9,6 @@
owner: root
group: root
mode: "0644"
- name: timescale_db_el | Install the timescale DB package on EL
ansible.builtin.yum:
pkg: '{{ timescale_db_el_pkgs }}'
@ -38,3 +37,18 @@
value: "{% if item.set %}{{ item.value }}{% else %}default{% endif %}"
loop: '{{ timescaledb_configuration_settings }}'
notify: Reload postgresql
- name: timescale_db_el | Ensure that the conf.d directory exists
ansible.builtin.file:
dest: "{{ psql_el_conf_dir }}/conf.d"
state: directory
owner: postgres
group: postgres
mode: "0750"
- name: timescale_db_el | Some settings must be written into a config file
become: true
become_user: postgres
ansible.builtin.template:
src: timescaledb.conf.j2
dest: "{{ psql_el_conf_dir }}/conf.d/timescaledb.conf"
mode: "0644"
notify: Restart postgresql

View File

@ -0,0 +1,5 @@
{% for opt in timescaledb_conf_settings_in_file %}
{% if opt.set %}
{{ opt.name }} = {{ opt.value }}
{% endif %}
{% endfor %}