我正在尝试让 Postgresql 在虚拟环境中工作,但是当我进行“无所事事” 并开始配置时,它会显示“ TypeError:: :1/128和127.0.0.1/32的版本不同” 。之后,我做了“无用的准备”,一切都很好。
该规定应在第一次运行时起作用。我正在使用ansible,vagrant和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: *****