Hello ,
I also checked below code
- name: Replace postgresql configuration file to allow remote connection
ansible.builtin.lineinfile:
path: "{{ postgresql_conf_file }}"
line: '{{ item }}'
owner: postgres
group: postgres
mode: '0644'
with_items:
- "listen_addresses = '*'"
- "port = 5432"
become: yes
become_user: root
- name: "Allow md5 connection for the db user"
postgresql_pg_hba:
dest: "{{ pg_hba_file}}"
contype: host
databases: all
source: "
0.0.0.0/0"
method: md5
users: "all"
create: true
become: yes
become_user: root
I hope it will help you..!
Regards,
Ajay