Skip to content

Install Postgres with SSL for Dev purposes.

Notifications You must be signed in to change notification settings

TeamSalvador/ansible-role-postgres_ssl

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

postgres

The postgres role will install Postgresql software and configure databases and users. PostgreSQL will run with SSL.

Role Variables

postgres_enabled: true

Postgresql users and databases/schemas

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",
  }

Example Playbook

---
- hosts: database
  collections:
    - community.postgresql
    - community.crypto
    - community.general
  roles:
    - postgres

About

Install Postgres with SSL for Dev purposes.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Jinja 66.9%
  • YAML 33.1%