---
# This is necessary to install the latest versions of Postgres
# For details see https://wiki.postgresql.org/wiki/Apt

- name: Add Postgres repo to sources list
  apt_repository: repo='deb http://apt.postgresql.org/pub/repos/apt/ {{ distro }}-pgdg main' state=present
  sudo: yes

- name: Add key for Postgres repo
  apt_key: url=https://www.postgresql.org/media/keys/ACCC4CF8.asc state=present
  sudo: yes

---
# This is necessary to install the latest versions of Postgres
# For details see https://wiki.postgresql.org/wiki/Apt

- name: Add key for Postgres repo
  apt_key: url=https://www.postgresql.org/media/keys/ACCC4CF8.asc state=present
  sudo: yes

- name: Add Postgres repo to sources list
  apt_repository: repo='deb http://apt.postgresql.org/pub/repos/apt/ {{ distro }}-pgdg main' state=present
  sudo: yes

Add key before adding repository
Add key before adding repository
