Skip to content

Commit

Permalink
feat: add option to set extra postgresql.conf params
Browse files Browse the repository at this point in the history
  • Loading branch information
ehh-why-its-so-hard committed Nov 21, 2024
1 parent 67d360e commit c08b93c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions roles/vega_postgresql/defaults/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ vega_postgresql_db_users:

vega_postgresql_external_data_directory: "/home/vega/postgresql"
vega_postgresql_allow_remote_access: false
vega_postgresql_extra_postgresql_conf_params: {}
12 changes: 10 additions & 2 deletions roles/vega_postgresql/tasks/configure.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
args:
creates: /.timescaledb-tune-finished


- name: Configure | Custom configuration changes to postgresql.conf
ansible.builtin.lineinfile:
path: "/etc/postgresql/{{- vega_postgresql_version -}}/main/postgresql.conf"
Expand Down Expand Up @@ -42,6 +41,15 @@
internal_postgresql_home: "/var/lib/postgresql/{{- vega_postgresql_version -}}/main"
register: psql_config


- name: Configure | Extra postgresql.conf changes
ansible.builtin.lineinfile:
path: "/etc/postgresql/{{- vega_postgresql_version -}}/main/postgresql.conf"
regexp: "^#?{{ item.key }} =.*"
line: "{{ item.key }} = {{ item.value }}"
with_dict: "{{ vega_postgresql_extra_postgresql_conf_params }}"
register: psql_config_extra

- name: Configure | Check if data already migrated
ansible.builtin.stat:
path: "{{- vega_postgresql_external_data_directory -}}/main"
Expand All @@ -67,4 +75,4 @@
state: restarted
enabled: true
name: postgresql
when: psql_config.changed or migrate_psql_home.changed
when: psql_config.changed or migrate_psql_home.changed or psql_config_extra.changed

0 comments on commit c08b93c

Please sign in to comment.