ansible-role-postgresql/tasks/postgresql_org_repo.yml

32 lines
1.1 KiB
YAML

---
- 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
- 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' ]