diff --git a/roles/postgresql_server/tasks/main.yml b/roles/postgresql_server/tasks/main.yml index 22e5cd12a4..2f941b9754 100644 --- a/roles/postgresql_server/tasks/main.yml +++ b/roles/postgresql_server/tasks/main.yml @@ -2,17 +2,6 @@ # # Setup postgresql server. # -- name: On rhel8 hosts enable the postgresql 12 module. - ansible.builtin.copy: - dest: /etc/dnf/modules.d/postgresql.module - content: | - [postgresql] - name=postgresql - stream=12 - profiles= - state=enabled - when: ansible_distribution_major_version|int == 8 - - name: On db-koji01 and db-riscv-koji01 and db01.stg and db-fas01 and db01 and db-openqa01 enable the postgresql 15 module. ansible.builtin.copy: dest: /etc/dnf/modules.d/postgresql.module @@ -24,19 +13,16 @@ state=enabled when: inventory_hostname.startswith(('db-koji01','db-riscv-koji01','db01.stg','db-fas01','db01','db-openqa01')) -- name: Install postgresql server packages (EL < 8) - ansible.builtin.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: On stg db-koji01 and db-riscv-koji01 and db01.stg and db-fas01 and db01 and db-openqa01 enable the postgresql 16 module. + ansible.builtin.copy: + dest: /etc/dnf/modules.d/postgresql.module + content: | + [postgresql] + name=postgresql + stream=16 + profiles= + state=enabled + when: inventory_hostname.startswith(('db-koji01.stg','db-riscv-koji01.stg','db01.stg','db-fas01.stg','db-openqa01.stg')) - name: Install postgresql server packages (Fedora) ansible.builtin.package: @@ -104,24 +90,6 @@ - config - postgresql -- name: Postgresql config template (el7 / postgresql 9.2) - ansible.builtin.template: dest=/var/lib/pgsql/data/postgresql.conf src=postgresql.conf - when: ansible_distribution_major_version|int < 8 and ansible_distribution == 'RedHat' - notify: - - Restart postgresql - tags: - - config - - postgresql - -- name: Postgresql config template (Fedora / el8 / postgresql 12) - ansible.builtin.template: dest=/var/lib/pgsql/data/postgresql.conf src=postgresql.conf-12 - when: (ansible_distribution_major_version|int == 8 and ansible_distribution == 'RedHat') or ansible_distribution != 'RedHat' - notify: - - Restart postgresql - tags: - - config - - postgresql - - name: Postgresql config template (el9 / postgresql 15) ansible.builtin.template: dest=/var/lib/pgsql/data/postgresql.conf src=postgresql.conf-15 when: (ansible_distribution_major_version|int == 9 and ansible_distribution == 'RedHat') @@ -131,6 +99,15 @@ - config - postgresql +- name: Postgresql config template (el9 / postgresql 16) + ansible.builtin.template: dest=/var/lib/pgsql/data/postgresql.conf src=postgresql.conf-16 + when: (ansible_distribution_major_version|int == 9 and ansible_distribution == 'RedHat') + notify: + - Restart postgresql + tags: + - config + - postgresql + - name: Ensure postgres has a place to backup to ansible.builtin.file: dest=/backups state=directory owner=postgres tags: