The postgres role will install Postgresql software and configure databases and users. PostgreSQL will run with SSL.
postgres_enabled: true
database:
postgres:
name: postgres
owner: postgres
username: postgres
password: "{{ lookup('env', 'DB_PASS') }}"
enabled: true
By default, the pg_hba.conf client authentication file is configured for open access for development purposes through the postgres_allowed_hosts variable:
# Set the hosts that can access the database
# The first allows SSL with password from the same subnet
# The second does not require SSL
postgres_allowed_hosts:
- {
type: "hostssl",
database: "all",
user: "all",
address: "samenet",
method: "password",
}
- {
type: "host",
database: "all",
user: "all",
address: "127.0.0.1/0",
method: "password"
}
- {
type: "hostnossl",
database: "all",
user: "all",
address: "0.0.0.0/0",
method: "reject",
}
---
- hosts: database
collections:
- community.postgresql
- community.crypto
- community.general
roles:
- postgres