Skip to content

Commit

Permalink
Allow creating directories for tablespaces
Browse files Browse the repository at this point in the history
When creating tablespaces on PostgreSQL using "CREATE TABLESPACE"
statements, PostgreSQL requires that these directories already exist[1].
Allow creating tablespace directories from this role.

1. https://www.postgresql.org/docs/10/sql-createtablespace.html

Co-authored-by: Samuel Githengi <[email protected]>
Signed-off-by: Jason Rogena <[email protected]>
  • Loading branch information
2 people authored and morrismukiri committed Aug 12, 2021
1 parent 96613d7 commit c1f835f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -672,6 +672,7 @@ postgresql_search_path: # schema names
postgresql_default_tablespace: "" # a tablespace name, "" uses the default
postgresql_temp_tablespaces: [] # a list of tablespace names
postgresql_default_table_access_method: "heap"
postgresql_tablespaces_dirs: [] # a list of directories for tablespaces to be created

postgresql_check_function_bodies: on
postgresql_default_transaction_isolation: "read committed"
Expand Down
9 changes: 9 additions & 0 deletions tasks/configure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@
mode: 0700
register: pgdata_dir_exist

- name: PostgreSQL | Make sure postgres tablespaces directories exist
file:
path: "{{ item }}"
owner: "{{ postgresql_service_user }}"
group: "{{ postgresql_service_group }}"
state: directory
mode: 0700
with_items: "{{ postgresql_tablespaces_dirs }}"

- name: PostgreSQL | Make sure the postgres WAL directory exists
file:
path: "{{ postgresql_wal_directory }}"
Expand Down

0 comments on commit c1f835f

Please sign in to comment.