Skip to content

Commit

Permalink
Add unix socket directory configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
teddyphreak committed Mar 18, 2024
1 parent beadce2 commit e6e9452
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 5 deletions.
1 change: 1 addition & 0 deletions defaults/main/params.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion handlers/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
- name: Reload PostgreSQL

Check failure on line 2 in handlers/main.yml

View workflow job for this annotation

GitHub Actions / molecule (masked, ubuntu2204, /lib/systemd/systemd)

no-changed-when

Commands should not change things if nothing needs doing.

Check warning on line 2 in handlers/main.yml

View workflow job for this annotation

GitHub Actions / molecule (masked, ubuntu2204, /lib/systemd/systemd)

args[module]

Unsupported parameters for (basic.py) module: name, state. Supported parameters include: _raw_params, _uses_shell, argv, chdir, creates, executable, expand_argument_vars, removes, stdin, stdin_add_newline, strip_empty_ends.

Check failure on line 2 in handlers/main.yml

View workflow job for this annotation

GitHub Actions / molecule (databases, ubuntu2204, /lib/systemd/systemd)

no-changed-when

Commands should not change things if nothing needs doing.

Check warning on line 2 in handlers/main.yml

View workflow job for this annotation

GitHub Actions / molecule (databases, ubuntu2204, /lib/systemd/systemd)

args[module]

Unsupported parameters for (basic.py) module: name, state. Supported parameters include: _raw_params, _uses_shell, argv, chdir, creates, executable, expand_argument_vars, removes, stdin, stdin_add_newline, strip_empty_ends.

Check failure on line 2 in handlers/main.yml

View workflow job for this annotation

GitHub Actions / molecule (stopped, rockylinux9, /usr/lib/systemd/systemd)

no-changed-when

Commands should not change things if nothing needs doing.

Check warning on line 2 in handlers/main.yml

View workflow job for this annotation

GitHub Actions / molecule (stopped, rockylinux9, /usr/lib/systemd/systemd)

args[module]

Unsupported parameters for (basic.py) module: name, state. Supported parameters include: _raw_params, _uses_shell, argv, chdir, creates, executable, expand_argument_vars, removes, stdin, stdin_add_newline, strip_empty_ends.

Check failure on line 2 in handlers/main.yml

View workflow job for this annotation

GitHub Actions / molecule (masked, debian11, /lib/systemd/systemd)

no-changed-when

Commands should not change things if nothing needs doing.

Check warning on line 2 in handlers/main.yml

View workflow job for this annotation

GitHub Actions / molecule (masked, debian11, /lib/systemd/systemd)

args[module]

Unsupported parameters for (basic.py) module: name, state. Supported parameters include: _raw_params, _uses_shell, argv, chdir, creates, executable, expand_argument_vars, removes, stdin, stdin_add_newline, strip_empty_ends.

Check failure on line 2 in handlers/main.yml

View workflow job for this annotation

GitHub Actions / molecule (databases, debian12, /lib/systemd/systemd)

no-changed-when

Commands should not change things if nothing needs doing.

Check warning on line 2 in handlers/main.yml

View workflow job for this annotation

GitHub Actions / molecule (databases, debian12, /lib/systemd/systemd)

args[module]

Unsupported parameters for (basic.py) module: name, state. Supported parameters include: _raw_params, _uses_shell, argv, chdir, creates, executable, expand_argument_vars, removes, stdin, stdin_add_newline, strip_empty_ends.

Check failure on line 2 in handlers/main.yml

View workflow job for this annotation

GitHub Actions / molecule (configure, debian11, /lib/systemd/systemd)

no-changed-when

Commands should not change things if nothing needs doing.

Check warning on line 2 in handlers/main.yml

View workflow job for this annotation

GitHub Actions / molecule (configure, debian11, /lib/systemd/systemd)

args[module]

Unsupported parameters for (basic.py) module: name, state. Supported parameters include: _raw_params, _uses_shell, argv, chdir, creates, executable, expand_argument_vars, removes, stdin, stdin_add_newline, strip_empty_ends.

Check failure on line 2 in handlers/main.yml

View workflow job for this annotation

GitHub Actions / molecule (masked, ubuntu2004, /lib/systemd/systemd)

no-changed-when

Commands should not change things if nothing needs doing.

Check warning on line 2 in handlers/main.yml

View workflow job for this annotation

GitHub Actions / molecule (masked, ubuntu2004, /lib/systemd/systemd)

args[module]

Unsupported parameters for (basic.py) module: name, state. Supported parameters include: _raw_params, _uses_shell, argv, chdir, creates, executable, expand_argument_vars, removes, stdin, stdin_add_newline, strip_empty_ends.

Check failure on line 2 in handlers/main.yml

View workflow job for this annotation

GitHub Actions / molecule (stopped, debian12, /lib/systemd/systemd)

no-changed-when

Commands should not change things if nothing needs doing.

Check warning on line 2 in handlers/main.yml

View workflow job for this annotation

GitHub Actions / molecule (stopped, debian12, /lib/systemd/systemd)

args[module]

Unsupported parameters for (basic.py) module: name, state. Supported parameters include: _raw_params, _uses_shell, argv, chdir, creates, executable, expand_argument_vars, removes, stdin, stdin_add_newline, strip_empty_ends.

Check failure on line 2 in handlers/main.yml

View workflow job for this annotation

GitHub Actions / lint

no-changed-when

Commands should not change things if nothing needs doing.

Check warning on line 2 in handlers/main.yml

View workflow job for this annotation

GitHub Actions / lint

args[module]

Unsupported parameters for (basic.py) module: name, state. Supported parameters include: _raw_params, _uses_shell, argv, chdir, creates, executable, expand_argument_vars, removes, stdin, stdin_add_newline, strip_empty_ends.

Check failure on line 2 in handlers/main.yml

View workflow job for this annotation

GitHub Actions / molecule (stopped, ubuntu2204, /lib/systemd/systemd)

no-changed-when

Commands should not change things if nothing needs doing.

Check warning on line 2 in handlers/main.yml

View workflow job for this annotation

GitHub Actions / molecule (stopped, ubuntu2204, /lib/systemd/systemd)

args[module]

Unsupported parameters for (basic.py) module: name, state. Supported parameters include: _raw_params, _uses_shell, argv, chdir, creates, executable, expand_argument_vars, removes, stdin, stdin_add_newline, strip_empty_ends.

Check failure on line 2 in handlers/main.yml

View workflow job for this annotation

GitHub Actions / molecule (deploy, ubuntu2004, /lib/systemd/systemd)

no-changed-when

Commands should not change things if nothing needs doing.

Check warning on line 2 in handlers/main.yml

View workflow job for this annotation

GitHub Actions / molecule (deploy, ubuntu2004, /lib/systemd/systemd)

args[module]

Unsupported parameters for (basic.py) module: name, state. Supported parameters include: _raw_params, _uses_shell, argv, chdir, creates, executable, expand_argument_vars, removes, stdin, stdin_add_newline, strip_empty_ends.

Check failure on line 2 in handlers/main.yml

View workflow job for this annotation

GitHub Actions / molecule (databases, rockylinux9, /usr/lib/systemd/systemd)

no-changed-when

Commands should not change things if nothing needs doing.

Check warning on line 2 in handlers/main.yml

View workflow job for this annotation

GitHub Actions / molecule (databases, rockylinux9, /usr/lib/systemd/systemd)

args[module]

Unsupported parameters for (basic.py) module: name, state. Supported parameters include: _raw_params, _uses_shell, argv, chdir, creates, executable, expand_argument_vars, removes, stdin, stdin_add_newline, strip_empty_ends.

Check failure on line 2 in handlers/main.yml

View workflow job for this annotation

GitHub Actions / molecule (stopped, ubuntu2004, /lib/systemd/systemd)

no-changed-when

Commands should not change things if nothing needs doing.

Check warning on line 2 in handlers/main.yml

View workflow job for this annotation

GitHub Actions / molecule (stopped, ubuntu2004, /lib/systemd/systemd)

args[module]

Unsupported parameters for (basic.py) module: name, state. Supported parameters include: _raw_params, _uses_shell, argv, chdir, creates, executable, expand_argument_vars, removes, stdin, stdin_add_newline, strip_empty_ends.

Check failure on line 2 in handlers/main.yml

View workflow job for this annotation

GitHub Actions / molecule (databases, debian11, /lib/systemd/systemd)

no-changed-when

Commands should not change things if nothing needs doing.

Check warning on line 2 in handlers/main.yml

View workflow job for this annotation

GitHub Actions / molecule (databases, debian11, /lib/systemd/systemd)

args[module]

Unsupported parameters for (basic.py) module: name, state. Supported parameters include: _raw_params, _uses_shell, argv, chdir, creates, executable, expand_argument_vars, removes, stdin, stdin_add_newline, strip_empty_ends.

Check failure on line 2 in handlers/main.yml

View workflow job for this annotation

GitHub Actions / molecule (masked, rockylinux9, /usr/lib/systemd/systemd)

no-changed-when

Commands should not change things if nothing needs doing.

Check warning on line 2 in handlers/main.yml

View workflow job for this annotation

GitHub Actions / molecule (masked, rockylinux9, /usr/lib/systemd/systemd)

args[module]

Unsupported parameters for (basic.py) module: name, state. Supported parameters include: _raw_params, _uses_shell, argv, chdir, creates, executable, expand_argument_vars, removes, stdin, stdin_add_newline, strip_empty_ends.

Check failure on line 2 in handlers/main.yml

View workflow job for this annotation

GitHub Actions / molecule (deploy, ubuntu2204, /lib/systemd/systemd)

no-changed-when

Commands should not change things if nothing needs doing.

Check warning on line 2 in handlers/main.yml

View workflow job for this annotation

GitHub Actions / molecule (deploy, ubuntu2204, /lib/systemd/systemd)

args[module]

Unsupported parameters for (basic.py) module: name, state. Supported parameters include: _raw_params, _uses_shell, argv, chdir, creates, executable, expand_argument_vars, removes, stdin, stdin_add_newline, strip_empty_ends.

Check failure on line 2 in handlers/main.yml

View workflow job for this annotation

GitHub Actions / molecule (deploy, debian12, /lib/systemd/systemd)

no-changed-when

Commands should not change things if nothing needs doing.

Check warning on line 2 in handlers/main.yml

View workflow job for this annotation

GitHub Actions / molecule (deploy, debian12, /lib/systemd/systemd)

args[module]

Unsupported parameters for (basic.py) module: name, state. Supported parameters include: _raw_params, _uses_shell, argv, chdir, creates, executable, expand_argument_vars, removes, stdin, stdin_add_newline, strip_empty_ends.

Check failure on line 2 in handlers/main.yml

View workflow job for this annotation

GitHub Actions / molecule (configure, ubuntu2204, /lib/systemd/systemd)

no-changed-when

Commands should not change things if nothing needs doing.

Check warning on line 2 in handlers/main.yml

View workflow job for this annotation

GitHub Actions / molecule (configure, ubuntu2204, /lib/systemd/systemd)

args[module]

Unsupported parameters for (basic.py) module: name, state. Supported parameters include: _raw_params, _uses_shell, argv, chdir, creates, executable, expand_argument_vars, removes, stdin, stdin_add_newline, strip_empty_ends.
ansible.builtin.service:
ansible.builtin.command:
name: "{{ _postgresql_service_name }}"
state: "reloaded"
when: postgresql_service_state == 'started'
Expand Down
10 changes: 10 additions & 0 deletions tasks/configure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
6 changes: 3 additions & 3 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion templates/postgresql.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}'

0 comments on commit e6e9452

Please sign in to comment.