---
- name: apt | Install PostgreSQL
  become: yes
  apt:
    name: postgresql
    state: installed
  register: _task
  retries: 5
  delay: 3
  until: _task is succeeded
  tags: [db, postgresql]

- name: apt | Start and Enable PostgreSQL
  become: yes
  service:
    name: postgresql
    state: started
    enabled: yes
  tags: [db, postgresql]

---
- name: apt | Install PostgreSQL
  become: yes
  apt:
    name: postgresql
    state: present
  register: _task
  retries: 5
  delay: 3
  until: _task is succeeded
  tags: [db, postgresql]

- name: apt | Start and Enable PostgreSQL
  become: yes
  service:
    name: postgresql
    state: started
    enabled: yes
  tags: [db, postgresql]

Use state=present instead of state=installed
Use state=present instead of state=installed
