postgresql_server: update for modern Fedora

Looks like this role hasn't been used on a Fedora box for a
while so things are kinda broken. Re-arrange all the package
install sections to be together, use newer package names on
Fedora (the Fedora and EL >= 8 sections are identical for now
but I figured I'd keep them separate in case that changes), and
use the newer config file, not the older one, on Fedora.

Signed-off-by: Adam Williamson <awilliam@redhat.com>
This commit is contained in:
Adam Williamson 2022-06-07 15:40:56 -07:00
parent fbda7b18a0
commit e6746d768b

View file

@ -2,34 +2,6 @@
#
# Setup postgresql server.
#
- name: install postgresql server packages (yum)
package:
state: present
name:
- postgresql-server
- postgresql-contrib
- postgresql-plpython
- python-psycopg2
- pxz
when: ansible_distribution_major_version|int < 8 and ansible_distribution == 'RedHat'
tags:
- packages
- postgresql
- name: install postgresql server packages (dnf)
package:
state: present
name:
- postgresql-server
- postgresql-contrib
- postgresql-plpython
- python-psycopg2
- pxz
when: ansible_distribution_major_version|int >= 29 and ansible_distribution == 'Fedora' and ansible_cmdline.ostree is not defined
tags:
- packages
- postgresql
- name: on rhel8 hosts enable the postgresql 12 module.
copy:
dest: /etc/dnf/modules.d/postgresql.module
@ -52,7 +24,35 @@
state=enabled
when: inventory_hostname.startswith('db-fas01.stg')
- name: install postgresql server packages (dnf)
- name: install postgresql server packages (EL < 8)
package:
state: present
name:
- postgresql-server
- postgresql-contrib
- postgresql-plpython
- python-psycopg2
- pxz
when: ansible_distribution_major_version|int < 8 and ansible_distribution == 'RedHat'
tags:
- packages
- postgresql
- name: install postgresql server packages (Fedora)
package:
state: present
name:
- postgresql-server
- postgresql-contrib
- postgresql-plpython3
- python3-psycopg2
- pxz
when: ansible_distribution_major_version|int >= 29 and ansible_distribution == 'Fedora' and ansible_cmdline.ostree is not defined
tags:
- packages
- postgresql
- name: install postgresql server packages (EL >= 8)
package:
state: present
name:
@ -106,16 +106,16 @@
- name: postgresql config template (el7 / postgresql 9.2)
template: dest=/var/lib/pgsql/data/postgresql.conf src=postgresql.conf
when: (ansible_distribution_major_version|int < 8 and ansible_distribution == 'RedHat') or ansible_distribution != 'RedHat'
when: ansible_distribution_major_version|int < 8 and ansible_distribution == 'RedHat'
notify:
- restart postgresql
tags:
- config
- postgresql
- name: postgresql config template (el8 / postgresql 12)
- name: postgresql config template (Fedora / el8 / postgresql 12)
template: dest=/var/lib/pgsql/data/postgresql.conf src=postgresql.conf-12
when: ansible_distribution_major_version|int > 7 and ansible_distribution == 'RedHat'
when: (ansible_distribution_major_version|int > 7 and ansible_distribution == 'RedHat') or ansible_distribution != 'RedHat'
notify:
- restart postgresql
tags: