Skip to content

Commit

Permalink
postgresql: Add option to install glibc-langpack for a non-english da…
Browse files Browse the repository at this point in the history
…tabase.
  • Loading branch information
JGoutin committed Jul 26, 2024
1 parent 0b23caf commit 65eed05
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
13 changes: 7 additions & 6 deletions roles/postgresql/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,13 @@ Security:

### Optional

| Name | Default Value | Description |
|-----------------------|------------------|------------------------------------------------------------------------------------|
| `postgresql_data` | `/var/lib/pgsql` | Path to the database. A `data` subdirectory is created inside this directory. |
| `postgresql_database` | | If specified, creates a database with this name. |
| `postgresql_upgrade` | true | If `true`, the role will upgrade and reindex the database if required. |
| `postgresql_user` | | If specified, creates a database user with this name, must match a Unix user name. |
| Name | Default Value | Description |
|------------------------|------------------|------------------------------------------------------------------------------------|
| `postgresql_data` | `/var/lib/pgsql` | Path to the database. A `data` subdirectory is created inside this directory. |
| `postgresql_database` | | If specified, creates a database with this name. |
| `postgresql_local` | | If specified, install associated language packs. |
| `postgresql_upgrade` | true | If `true`, the role will upgrade and reindex the database if required. |
| `postgresql_user` | | If specified, creates a database user with this name, must match a Unix user name. |

## Example Playbook

Expand Down
12 changes: 12 additions & 0 deletions roles/postgresql/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,18 @@
register: _
until: _ is successful

- name: Ensure Required language packs are installed
ansible.builtin.dnf:
state: present
name:
- "glibc-langpack-{{ postgresql_local }}"
install_weak_deps: false
retries: 10
delay: 1
register: _
until: _ is successful
when: postgresql_local is defined

- name: Ensure database version is up to date with PostgreSQL engine version
ansible.builtin.command: /usr/bin/postgresql-setup --upgrade
register: pg_upgrade
Expand Down

0 comments on commit 65eed05

Please sign in to comment.