~sirn/ansible-freebsd-s6-postgresql

Ansible role for installing and configuring PostgreSQL on S6-enabled FreeBSD host
handlers: fix become user

refs

master
browse  log 

clone

read-only
https://git.sr.ht/~sirn/ansible-freebsd-s6-postgresql
read/write
git@git.sr.ht:~sirn/ansible-freebsd-s6-postgresql

You can also use your local clone with git send-email.

#ansible-freebsd-s6-postgresql

builds.sr.ht status

Configure PostgreSQL for FreeBSD host using S6.

Requires ansible-freebsd-s6 to be applied first.

#Variables

#postgresql_addresses
postgresql_addresses:
    - "*"

TCP address for PostgreSQL to listen for connections. By default * will listen to all addresses.

#postgresql_dir
postgresql_dir: /var/db/postgres

Directory to store PostgreSQL database.

#postgresql_databases
postgresql_databases: []

Default database to create during initial server setup. You must change the password. This setting accept a list of objects as its argument, e.g.

postgresql_databases:
    - user: "{{ansible_user}}"
      password: "passw0rd"
      databases:
          - "{{ansible_user}}"
  • user username to connect to PostgreSQL server
  • password password for the given user
  • databases list of database name to create and grant access to user

It is possible to omit password in case no passwords should be modified, but only granting database access. It is a good idea to have user with the same username as ansible_user for maintenance purpose.

#postgresql_hba
postgresql_hba:
    - { type: host, database: all, user: all, address: 0.0.0.0/0, method: md5 }

Define the host-based authentication, see also The pg_hba.conf file section in PostgreSQL manual. By default, this settings allow all users to connect to the server as long as they are authorized with password.

#postgresql_hba_trust_local
postgresql_hba_trust_local: no

Add a host-based authentication to allow all connection from localhost without password authentication.

#postgresql_logger
postgresql_logger: |
    #!/usr/local/bin/execlineb -P
    s6-log -b n10 s1000000 t !"gzip -nq9" /var/log/postgresql/

Configure a PostgreSQL logger. See also s6-log.

#postgresql_max_connections
postgresql_max_connections: 256

Set maximum connection that may connect to the PostgreSQL server.

#postgresql_port
postgresql_port: 5432

Specify a TCP port for PostgreSQL to listen for.

#postgresql_shared_buffers
postgresql_shared_buffers: 512MB

Sets how much memory is dedicated to PostgreSQL to use for caching data.

#postgresql_unix_socket_directories
postgresql_unix_socket_directories:
    - /tmp

Directory to write UNIX socket to.

#postgresql_version
postgresql_version: 10

PostgreSQL version to install.