---

- name: ansible postgresql requirements install
  apt:
    force_apt_get: true
    install_recommends: false
    name: python3-psycopg2

- name: postgresql install
  apt:
    force_apt_get: true
    install_recommends: false
    name: postgresql

- name: ensure postgresql is running
  service:
    name: postgresql
    state: started

- name: postgresql set superuser password
  become: true
  become_user: postgres
  postgresql_user:
    name: postgres
    password: "{{ postgres_pwd }}"

# FIREWALL

- name: firewall
  when: postgres_firewall_enabled
  vars:
    ferm_rules_filename: "{{ postgres_ferm_rules_filename }}"
    ferm_input_rules: "{{ postgres_ferm_input_rules }}"
    ferm_output_rules: "{{ postgres_ferm_output_rules }}"
    ferm_global_settings: "{{ postgres_ferm_global_settings }}"
  include_role:
    name: ferm

- meta: flush_handlers

...
