Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add socket directory config manage flag #25

Merged
merged 2 commits into from
Mar 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 22 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,28 @@ The following is the list of end-user serviceable parameters:

Global PostgreSQL configuration

| Parameter | Default | Type | Description | Required |
|:-----------------------------|----------------:|:-------|:-------------------------------------------|:---------|
| postgresql_release | 16 | string | Target PostgreSQL major release | false |
| postgresql_user | postgres | string | OS user for postgres daemon | false |
| postgresql_group | postgres | string | OS group for postgres daemon | false |
| postgresql_package_state | present | string | PostgreSQL package state | false |
| postgresql_service_state | started | string | PostgreSQL service state | false |
| postgresql_service_enabled | true | bool | Start PostgreSQL on boot | false |
| postgresql_roles | [] | list | List of PostgreSQL roles | false |
| postgresql_databases | [] | list | List of PostgreSQL databases | false |
| postgresql_hba_entries | [] | list | List of HBA entries | false |
| postgresql_ident_entries | [] | list | List of ident entries | false |
| postgresql_initdb | true | list | Toggle flag for database initialization | false |
| postgresql_conf_main_file | postgresql.conf | string | Main config file basename | false |
| postgresql_conf_ident_file | pg_ident.conf | string | Ident config file basename | false |
| postgresql_conf_hba_file | pg_hba.conf | string | HBA config file basename | false |
| postgresql_conf_main_manage | true | list | Toggle flag for postgresql.conf management | false |
| postgresql_conf_hba_manage | true | list | Toggle flag for pg_hba.conf management | false |
| postgresql_conf_ident_manage | true | list | Toggle flag for pg_ident.conf management | false |
| postgresql_role_manage | true | list | Toggle flag for role management | false |
| postgresql_datrabase_manage | true | list | Toggle flag for database management | false |
| Parameter | Default | Type | Description | Required |
|:---------------------------------|----------------:|:-------|:-----------------------------------------------|:---------|
| postgresql_release | 16 | string | Target PostgreSQL major release | false |
| postgresql_user | postgres | string | OS user for postgres daemon | false |
| postgresql_group | postgres | string | OS group for postgres daemon | false |
| postgresql_package_state | present | string | PostgreSQL package state | false |
| postgresql_service_state | started | string | PostgreSQL service state | false |
| postgresql_service_enabled | true | bool | Start PostgreSQL on boot | false |
| postgresql_roles | [] | list | List of PostgreSQL roles | false |
| postgresql_databases | [] | list | List of PostgreSQL databases | false |
| postgresql_hba_entries | [] | list | List of HBA entries | false |
| postgresql_ident_entries | [] | list | List of ident entries | false |
| postgresql_initdb | true | list | Toggle flag for database initialization | false |
| postgresql_conf_main_file | postgresql.conf | string | Main config file basename | false |
| postgresql_conf_ident_file | pg_ident.conf | string | Ident config file basename | false |
| postgresql_conf_hba_file | pg_hba.conf | string | HBA config file basename | false |
| postgresql_conf_main_manage | true | list | Toggle flag for postgresql.conf management | false |
| postgresql_conf_hba_manage | true | list | Toggle flag for pg_hba.conf management | false |
| postgresql_conf_ident_manage | true | list | Toggle flag for pg_ident.conf management | false |
| postgresql_conf_socketdir_manage | true | list | Toggle flag for socket directory configuration | false |
| postgresql_role_manage | true | list | Toggle flag for role management | false |
| postgresql_datrabase_manage | true | list | Toggle flag for database management | false |

Please refer to the [defaults directory](/defaults/main/) for an up to date list of input parameters.

Expand Down
1 change: 1 addition & 0 deletions defaults/main/params.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ postgresql_default_database: postgres
postgresql_locale: en_US.UTF-8
postgresql_conf_main_manage: true
postgresql_conf_hba_manage: true
postgresql_conf_socketdir_manage: true
postgresql_conf_ident_manage: true
postgresql_role_manage: "{{ postgresql_service_state == 'started' }}"
postgresql_database_manage: "{{ postgresql_service_state == 'started' }}"
Expand Down
2 changes: 2 additions & 0 deletions molecule/configure/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ provisioner:
vars:
postgresql_nolog: false
postgresql_conf_max_conns: 600
postgresql_conf_socketdir_manage: false
postgresql_conf_ident_manage: false
postgresql_conf_ansible: |
max_connections = {{ postgresql_conf_max_conns }}
verifier:
Expand Down
4 changes: 2 additions & 2 deletions tasks/lock.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
_packages: "{{ ([_postgresql_package_name] | flatten) }}"
_package_versions: "{{ _packages | map('regex_search', _version_regex) }}"
_package_holds: "{{ _package_versions | select('string') }}"
_package_target: "{{ item.split('=') | first }}"
_package_target: "{{ item.split('=') | first }}"
loop: "{{ _package_holds }}"
when:
- ansible_os_family == "Debian"
Expand All @@ -27,7 +27,7 @@
_packages: "{{ ([_postgresql_package_name] | flatten) }}"
_package_versions: "{{ _packages | map('regex_search', _version_regex) }}"
_package_holds: "{{ _package_versions | select('string') }}"
_package_target: "{{ item.split('=') | first }}"
_package_target: "{{ item.split('=') | first }}"
loop: "{{ _package_holds }}"
when:
- ansible_os_family == "RedHat"
Expand Down
1 change: 1 addition & 0 deletions tasks/vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
_postgresql_conf_main: "{{ _conf_confdir }}/{{ postgresql_conf_main_file | default('postgresql.conf') }}"
_postgresql_conf_ident: "{{ _conf_confdir }}/{{ postgresql_conf_ident_file | default('pg_ident.conf') }}"
_postgresql_conf_hba: "{{ _conf_confdir }}/{{ postgresql_conf_hba_file | default('pg_hba.conf') }}"
_postgresql_conf_socket: "{{ postgresql_conf_socketdir_manage | bool }}"
_postgresql_conf_ansible: "{{ _conf_include }}/{{ __postgresql_conf_ansible }}"
_postgresql_conf_pgaudit: "{{ _conf_include }}/{{ __postgresql_conf_pgaudit }}"
_postgresql_conf_pgcron: "{{ _conf_include }}/{{ __postgresql_conf_pgcron }}"
Expand Down
4 changes: 3 additions & 1 deletion templates/postgresql.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ include_dir = '{{ _postgresql_conf_include | basename }}'
listen_addresses = '*'

data_directory = '{{ _postgresql_datadir }}'
unix_socket_directories = '{{ _postgresql_socketdir }}, /tmp'
hba_file = '{{ _postgresql_conf_hba }}'
ident_file = '{{ _postgresql_conf_ident }}'
{%if _postgresql_conf_socket | bool %}
unix_socket_directories = '{{ _postgresql_socketdir }},/tmp'
{% endif %}
Loading