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


browse  log 



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


builds.sr.ht status

Configure PostgreSQL for FreeBSD host using S6.

Requires ansible-freebsd-s6 to be applied first.


    - "*"

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

postgresql_dir: /var/db/postgres

Directory to store PostgreSQL database.

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.

    - user: "{{ansible_user}}"
      password: "passw0rd"
          - "{{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.

    - { type: host, database: all, user: all, address:, 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: no

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

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: 256

Set maximum connection that may connect to the PostgreSQL server.

postgresql_port: 5432

Specify a TCP port for PostgreSQL to listen for.

postgresql_shared_buffers: 512MB

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

    - /tmp

Directory to write UNIX socket to.

postgresql_version: 10

PostgreSQL version to install.