postgresql_privs

Collection: community.general

Full Name: parallax.community.general.postgresql_privs

Aliases: community.general.postgresql_privs, postgresql_privs

Synopsis

Grant and revoke PostgreSQL privileges

Parameters

NameTypeRequiredDefaultDescription
databasestringyesName of the database to grant/revoke privileges on
rolesstringyesComma-separated list of role names
typestringtableType of database object (table, sequence, function, database, schema, etc.)
objsstringComma-separated list of database objects to set privileges on
privsstringComma-separated list of privileges to grant/revoke
statestringpresentState of the privileges Choices: present, absent
schemastringpublicSchema that contains the database objects
grant_optionboolfalseWhether to grant WITH GRANT OPTION
login_hoststringlocalhostHost running the database
login_userstringpostgresUser to authenticate with
login_passwordstringPassword for authentication
portint5432Database port to connect to
ssl_modestringpreferSSL mode for the connection
target_rolesstringTarget roles for default privileges

Example

- name: Grant the reporting role read access
  postgresql_privs:
    database: appdb
    roles: reporting
    type: table
    objs: ALL_IN_SCHEMA
    schema: public
    privs: SELECT
    state: present