From e6e9452eae2f548f644a925460764d47697556a3 Mon Sep 17 00:00:00 2001 From: Ted Cook Date: Mon, 18 Mar 2024 16:06:44 -0600 Subject: [PATCH] Add unix socket directory configuration --- defaults/main/params.yml | 1 + handlers/main.yml | 2 +- tasks/configure.yml | 10 ++++++++++ tasks/main.yml | 6 +++--- templates/postgresql.conf.j2 | 2 +- 5 files changed, 16 insertions(+), 5 deletions(-) diff --git a/defaults/main/params.yml b/defaults/main/params.yml index 163472c..bdfa287 100644 --- a/defaults/main/params.yml +++ b/defaults/main/params.yml @@ -11,6 +11,7 @@ postgresql_group: postgres postgresql_roles: [] postgresql_initdb: true postgresql_databases: [] +postgresql_profile: '/etc/profile.d/postgresql.sh' postgresql_auth_method: md5 # [ scram-sha-256 | md5 ] postgresql_default_database: postgres postgresql_locale: en_US.UTF-8 diff --git a/handlers/main.yml b/handlers/main.yml index 7b33dc4..ccf18ad 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -1,6 +1,6 @@ --- - name: Reload PostgreSQL - ansible.builtin.service: + ansible.builtin.command: name: "{{ _postgresql_service_name }}" state: "reloaded" when: postgresql_service_state == 'started' diff --git a/tasks/configure.yml b/tasks/configure.yml index 7e25c0e..f13878d 100644 --- a/tasks/configure.yml +++ b/tasks/configure.yml @@ -118,6 +118,16 @@ _entries: "{{ postgresql_hba_entries }}" notify: postgresql_restart +- name: Manage PostgreSQL profile configuration + ansible.builtin.lineinfile: + path: "{{ postgresql_profile }}" + line: "PATH={{ _postgresql_bindir }}:$PATH" + state: "{{ (postgresql_package_state == 'absent') | ternary('absent', 'present') }}" + create: true + owner: root + group: root + mode: 0644 + - name: Manage PostgreSQL service configuration when: ansible_os_family == 'RedHat' block: diff --git a/tasks/main.yml b/tasks/main.yml index 905bd85..a7e1a1c 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -11,12 +11,12 @@ - name: Manage PostgreSQL configuration ansible.builtin.include_tasks: configure.yml - - name: Flush handlers - ansible.builtin.meta: flush_handlers - - name: Manage PostgreSQL services ansible.builtin.include_tasks: service.yml + - name: Flush handlers + ansible.builtin.meta: flush_handlers + - name: Manage PostgreSQL roles ansible.builtin.include_tasks: roles.yml when: postgresql_service_state == 'started' diff --git a/templates/postgresql.conf.j2 b/templates/postgresql.conf.j2 index 95e589b..827bcc1 100644 --- a/templates/postgresql.conf.j2 +++ b/templates/postgresql.conf.j2 @@ -5,6 +5,6 @@ include_dir = '{{ _postgresql_conf_include | basename }}' listen_addresses = '*' data_directory = '{{ _postgresql_datadir }}' -unix_socket_directory = '{{ _postgresql_socketdir }}' +unix_socket_directories = '{{ _postgresql_socketdir }}, /tmp' hba_file = '{{ _postgresql_conf_hba }}' ident_file = '{{ _postgresql_conf_ident }}'