Skip to content
Open
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
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ jobs:
# - distro: rockylinux9
- distro: debian11
- distro: debian12
- distro: debian13
- distro: ubuntu2004
- distro: ubuntu2204
- distro: ubuntu2404
Expand Down
19 changes: 10 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Ansible role which installs and configures PostgreSQL, extensions, databases and

#### Installation

This has been tested on Ansible 2.4.0 and higher.
This has been tested on Ansible 2.5.0 and higher.

To install:

Expand Down Expand Up @@ -55,14 +55,15 @@ An example how to include this role as a task:
#### Compatibility matrix

| Distribution / PostgreSQL | 11 | 12 | 13 | 14 | 15 | 16 | 17 |
| ------------------------- | :--------: | :----------------: | :----------------: | :----------------: | :----------------: | :----------------: | :----------------: |
| Debian 11.x | :no_entry: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| Debian 12.x | :no_entry: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| Rockylinux 8.x | :no_entry: | :warning: | :warning: | :warning: | :warning: | :warning: | :warning: |
| Rockylinux 9.x | :no_entry: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :warning: |
| Ubuntu 20.04.x | :no_entry: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| Ubuntu 22.04.x | :no_entry: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| Ubuntu 24.04.x | :no_entry: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| ------------------------ | :--------: | :----------------: | :----------------: | :----------------: | :----------------: | :----------------: | :----------------: |
| Debian 11.x | :no_entry: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| Debian 12.x | :no_entry: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| Debian 13.x | :no_entry: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| Rockylinux 8.x | :no_entry: | :warning: | :warning: | :warning: | :warning: | :warning: | :warning: |
| Rockylinux 9.x | :no_entry: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :warning: |
| Ubuntu 20.04.x | :no_entry: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| Ubuntu 22.04.x | :no_entry: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| Ubuntu 24.04.x | :no_entry: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |


- :white_check_mark: - works fine
Expand Down
3 changes: 2 additions & 1 deletion defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -838,7 +838,8 @@ postgresql_install_repository: true
# APT settings
postgresql_apt_key_id: "ACCC4CF8"
postgresql_apt_key_url: "https://www.postgresql.org/media/keys/ACCC4CF8.asc"
postgresql_apt_repository: "deb http://apt.postgresql.org/pub/repos/apt/ {{ ansible_distribution_release }}-pgdg main {{ postgresql_version }}"
postgresql_apt_repository_url: "https://apt.postgresql.org/pub/repos/apt"
postgresql_apt_repository: "deb {{ postgresql_apt_repository_url }}/ {{ ansible_distribution_release }}-pgdg main {{ postgresql_version }}"
# Pin-Priority of PGDG repository
postgresql_apt_pin_priority: 500

Expand Down
2 changes: 2 additions & 0 deletions molecule/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ The default distribution is ubuntu2204. You can override th with setting the env
* fedora40
* debian11
* debian12
* debian13
* ubuntu2004
* ubuntu2204
* ubuntu2404
Expand Down Expand Up @@ -46,6 +47,7 @@ The playbooks read variables from two files. One common vars file, and one with
$ ls -1 tests/ | grep vars
vars.Debian.11.yml
vars.Debian.12.yml
vars.Debian.13.yml
vars.Fedora.40.yml
vars.Ubuntu.20.yml
vars.Ubuntu.22.yml
Expand Down
25 changes: 23 additions & 2 deletions tasks/install_apt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,40 @@
pkg: ca-certificates
state: present

- name: PostgreSQL | Add PostgreSQL repository (deb822)
ansible.builtin.deb822_repository:
name: postgresql
types: ["deb"]
uris: ["{{ postgresql_apt_repository_url }}"]
suites: ["{{ ansible_distribution_release }}-pgdg"]
components: ["main", "{{ postgresql_version }}"]
signed_by: "{{ postgresql_apt_key_url }}"
state: present
when:
- postgresql_install_repository
- ansible_facts.packages.apt is defined
- ansible_facts.packages.apt[0].version is version('2.4', '>=')

- name: PostgreSQL | Add PostgreSQL repository apt-key | apt
apt_key:
id: "{{ postgresql_apt_key_id }}"
url: "{{ postgresql_apt_key_url }}"
state: present
keyring: /etc/apt/trusted.gpg.d/postgresql.gpg
when: postgresql_apt_key_url and postgresql_apt_key_id and postgresql_install_repository
when:
- postgresql_apt_key_url
- postgresql_apt_key_id
- postgresql_install_repository
- ansible_facts.packages.apt[0].version is version('2.4', '<')

- name: PostgreSQL | Add PostgreSQL repository | apt
apt_repository:
repo: "{{ postgresql_apt_repository }}"
state: present
when: postgresql_apt_repository | default('') != '' and postgresql_install_repository
when:
- postgresql_apt_repository | default('') != ''
- postgresql_install_repository
- ansible_facts.packages.apt[0].version is version('2.4', '<')

- name: PostgreSQL | Add PostgreSQL repository preferences | apt
template:
Expand Down
4 changes: 4 additions & 0 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
- "../vars/empty.yml"
tags: [always]

- name: Gather package facts
ansible.builtin.package_facts:
manager: apt

- import_tasks: install_apt.yml
when: ansible_pkg_mgr == "apt"
tags: [postgresql, postgresql-install]
Expand Down
1 change: 1 addition & 0 deletions tests/vars.Debian.13.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
---
2 changes: 1 addition & 1 deletion vars/Debian_22.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@

postgresql_service_name: "postgresql"

postgresql_apt_repository: "deb [arch=amd64 signed-by=/etc/apt/trusted.gpg.d/postgresql.gpg] http://apt.postgresql.org/pub/repos/apt/ {{ ansible_distribution_release }}-pgdg main {{ postgresql_version }}"
postgresql_apt_repository: "deb [arch=amd64 signed-by=/etc/apt/trusted.gpg.d/postgresql.gpg] {{ postgresql_apt_repository_url }}/ {{ ansible_distribution_release }}-pgdg main {{ postgresql_version }}"
6 changes: 6 additions & 0 deletions vars/trixie.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
# PostgreSQL vars for Debian Trixie (13)

postgresql_ext_postgis_deps:
- "postgresql-{{postgresql_version}}-postgis-3"
- "postgresql-{{postgresql_version}}-postgis-3-scripts"
Loading