2020-06-03 19:53:13 +02:00
|
|
|
---
|
2020-07-30 14:14:39 +02:00
|
|
|
- name: Debian or Ubuntu
|
|
|
|
block:
|
|
|
|
- name: Get the signing key for the postgresql.org repository
|
|
|
|
apt_key: url=https://www.postgresql.org/media/keys/ACCC4CF8.asc state=present
|
2020-06-03 19:53:13 +02:00
|
|
|
|
2020-07-30 14:14:39 +02:00
|
|
|
- name: Setup the postgresql.org repository
|
|
|
|
apt_repository: repo='deb http://apt.postgresql.org/pub/repos/apt/ {{ ansible_lsb.codename }}-pgdg main' update_cache=yes
|
|
|
|
|
|
|
|
when:
|
|
|
|
- pg_use_postgresql_org_repo
|
|
|
|
- ansible_distribution_file_variety == "Debian"
|
|
|
|
tags: [ 'postgresql', 'postgresql_repo' ]
|
|
|
|
|
|
|
|
- name: EL
|
|
|
|
block:
|
|
|
|
- name: Install the pgsql pgdg repository
|
|
|
|
yum: name={{ psql_el_pgdg_repo_url }} state={{ psql_pkg_state }}
|
|
|
|
|
|
|
|
- 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
|
|
|
|
command: /usr/pgsql-{{ psql_version }}/bin/postgresql{{ psql_version }}-setup initdb
|
|
|
|
args:
|
|
|
|
creates: '{{ psql_data_dir }}/postgresql.conf'
|
|
|
|
|
|
|
|
when:
|
|
|
|
- pg_use_postgresql_org_repo
|
|
|
|
- ansible_distribution_file_variety == "RedHat"
|
|
|
|
tags: [ 'postgresql', 'postgresql_repo' ]
|