2020-06-03 19:53:13 +02:00
|
|
|
---
|
|
|
|
- block:
|
|
|
|
- name: install the postgresql packages
|
|
|
|
apt: pkg={{ postgresql_pkgs }} state={{ psql_pkg_state }} cache_valid_time=3600
|
|
|
|
notify: Restart postgresql
|
|
|
|
|
2020-07-30 14:14:39 +02:00
|
|
|
when: ansible_distribution_file_variety == "Debian"
|
|
|
|
tags: [ 'postgresql', 'postgres' ]
|
|
|
|
|
|
|
|
- name: EL
|
|
|
|
block:
|
|
|
|
- name: install the postgresql packages from the pgdg repository
|
|
|
|
yum: pkg={{ psql_el_pgdg_packages }} state={{ psql_pkg_state }}
|
|
|
|
|
|
|
|
- name: Init the db if needed
|
2020-07-30 16:13:32 +02:00
|
|
|
shell: /usr/pgsql-{{ psql_version }}/bin/postgresql-{{ psql_version }}-setup initdb
|
2020-07-30 14:14:39 +02:00
|
|
|
args:
|
2020-07-30 16:12:34 +02:00
|
|
|
creates: '{{ psql_el_data_dir }}/postgresql.conf'
|
2020-07-30 14:14:39 +02:00
|
|
|
|
|
|
|
when:
|
|
|
|
- not psql_install_scl_version
|
|
|
|
- ansible_distribution_file_variety == "RedHat"
|
2020-06-03 19:53:13 +02:00
|
|
|
tags: [ 'postgresql', 'postgres' ]
|
|
|
|
|
2020-07-30 14:14:39 +02:00
|
|
|
- name: EL from SCL
|
|
|
|
block:
|
|
|
|
- name: install the postgresql scl packages
|
|
|
|
yum: pkg={{ psql_el_scl_packages }} state={{ psql_pkg_state }}
|
|
|
|
|
|
|
|
- name: Init the db if needed
|
2020-07-30 16:12:34 +02:00
|
|
|
shell: /opt/rh/rh-postgresql{{ psql_version }}/root/usr/bin/postgresql-setup --initdb
|
2020-07-30 14:14:39 +02:00
|
|
|
args:
|
2020-07-30 16:12:34 +02:00
|
|
|
creates: '{{ psql_el_data_dir }}/postgresql.conf'
|
2020-07-30 14:14:39 +02:00
|
|
|
|
|
|
|
when:
|
|
|
|
- psql_install_scl_version
|
|
|
|
- ansible_distribution_file_variety == "RedHat"
|
|
|
|
tags: [ 'scl', 'postgresql', 'postgres' ]
|