# salt.states.postgres_initdb

## Initialization of PostgreSQL data directory

The postgres_initdb module is used to initialize the postgresql data directory.

Added in version 2016.3.0.

    pgsql-data-dir:
      postgres_initdb.present:
        - name: /var/lib/pgsql/data
        - auth: password
        - user: postgres
        - password: strong_password
        - encoding: UTF8
        - locale: C
        - runas: postgres
        - checksums: True
        - waldir: /var/postgresql/wal

salt.states.postgres_initdb.present(name, user=None, password=None, auth='password', encoding='UTF8', locale=None, runas=None, waldir=None, checksums=False)

  Initialize the PostgreSQL data directory

  name

    The name of the directory to initialize

  user

    The database superuser name

  password

    The password to set for the postgres user

  auth

    The default authentication method for local connections

  encoding

    The default encoding for new databases

  locale

    The default locale for new databases

  waldir

    The transaction log (WAL) directory (default is to keep WAL inside the data directory)

    Added in version 2019.2.0.

  checksums

    If True, the cluster will be created with data page checksums.

    Note

    Data page checksums are supported since PostgreSQL 9.3.

    Added in version 2019.2.0.

  runas

    The system user the operation should be performed on behalf of