::1/128 and 127.0.0.1/32 are not of the same version

Viewed 270

I'm trying to get Postgresql working in virtual environment but when I'm doing "vagrant up" and provisioning starts it says "TypeError: ::1/128 and 127.0.0.1/32 are not of the same version". After that I did "vagrant provision" and everything was fine.

What should I do that provision will work on first run. I'm using ansible, vagrant and python.

#This is part of my main.yml

# Initializing database
- name: create pg_hba file
  postgresql_pg_hba:
    dest: /etc/postgresql/9.6/main/pg_hba.conf
    contype: host
    users: postgres
    source: 127.0.0.1/32
    netmask: 127.0.0.1/32
    databases: all
    method: trust
    create: true

- name: ipv6
  blockinfile:
    dest: /etc/postgresql/9.6/main/pg_hba.conf
    block: |
      host  all postgres  1::128/128  trust    

- name: Ensure the PostgreSQL service is running
  service:
    name: postgresql
    state: started
    enabled: yes

- name: Create postgresql database named ddb
  become: true
  become_user: postgres
  postgresql_db:
    name: ddb
    port: 5432
    login_host: 127.0.0.1
    login_user: postgres
    login_password: *****
0 Answers
Related