salt.modules.postgres

### Navigation

- index
- modules |
- next |
- previous |
- « SaltStack.org |
- Documentation home
- Full list of builtin execution modules »

# salt.modules.postgres

Module to provide Postgres compatibility to salt.

In order to connect to Postgres, certain configuration is required in /etc/salt/minion on the relevant minions. Some sample configs might look like:

    postgres.host: 'localhost'
    postgres.port: '5432'
    postgres.user: 'postgres'
    postgres.pass: ''
    postgres.db: 'postgres'

This data can also be passed into pillar. Options passed into opts will overwrite options passed into pillar

`salt.modules.postgres.` `db_create`(name, user=None, host=None, port=None, tablespace=None, encoding=None, locale=None, lc_collate=None, lc_ctype=None, owner=None, template=None, runas=None)

  Adds a databases to the Postgres server.

  CLI Example:

      salt '*' postgres.db_create 'dbname'

      salt '*' postgres.db_create 'dbname' template=template_postgis

`salt.modules.postgres.` `db_exists`(name, user=None, host=None, port=None, runas=None)

  Checks if a database exists on the Postgres server.

  CLI Example:

      salt '*' postgres.db_exists 'dbname'

`salt.modules.postgres.` `db_list`(user=None, host=None, port=None, runas=None)

  Return a list of databases of a Postgres server using the output from the `psql -l` query.

  CLI Example:

      salt '*' postgres.db_list

`salt.modules.postgres.` `db_remove`(name, user=None, host=None, port=None, runas=None)

  Removes a databases from the Postgres server.

  CLI Example:

      salt '*' postgres.db_remove 'dbname'

`salt.modules.postgres.` `user_create`(username, user=None, host=None, port=None, createdb=False, createuser=False, encrypted=False, superuser=False, password=None, runas=None)

  Creates a Postgres user.

  CLI Examples:

      salt '*' postgres.user_create 'username' user='user' host='hostname' port='port' password='password'

`salt.modules.postgres.` `user_exists`(name, user=None, host=None, port=None, runas=None)

  Checks if a user exists on the Postgres server.

  CLI Example:

      salt '*' postgres.user_exists 'username'

`salt.modules.postgres.` `user_list`(user=None, host=None, port=None, runas=None)

  Return a list of users of a Postgres server.

  CLI Example:

      salt '*' postgres.user_list

`salt.modules.postgres.` `user_remove`(username, user=None, host=None, port=None, runas=None)

  Removes a user from the Postgres server.

  CLI Example:

      salt '*' postgres.user_remove 'username'

`salt.modules.postgres.` `user_update`(username, user=None, host=None, port=None, createdb=False, createuser=False, encrypted=False, password=None, runas=None)

  Creates a Postgres user.

  CLI Examples:

      salt '*' postgres.user_create 'username' user='user' host='hostname' port='port' password='password'

`salt.modules.postgres.` `version`()

  Return the version of a Postgres server using the output from the `psql --version` cmd.

  CLI Example:

      salt '*' postgres.version

## Comments

comments powered by Disqus

### Navigation

- index
- modules |
- next |
- previous |
- « SaltStack.org |
- Documentation home
- Full list of builtin execution modules »