postgresql_privs
Grant and revoke PostgreSQL privileges
Collection: community.postgresql
Full Name: parallax.community.general.postgresql_privs
Aliases: community.general.postgresql_privs, postgresql_privs, community.postgresql.postgresql_privs
Synopsis
Grant and revoke PostgreSQL privileges
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| database | string | yes | Name of the database to grant/revoke privileges on | |
| roles | string | yes | Comma-separated list of role names | |
| type | string | table | Type of database object (table, sequence, function, database, schema, etc.) | |
| objs | string | Comma-separated list of database objects to set privileges on | ||
| privs | string | Comma-separated list of privileges to grant/revoke | ||
| state | string | present | State of the privileges Choices: present, absent | |
| schema | string | Schema that contains the database objects | ||
| grant_option | bool | Whether to grant WITH GRANT OPTION | ||
| login_host | string | Host running the database | ||
| login_user | string | postgres | User to authenticate with | |
| login_password | string | Password for authentication | ||
| port | int | 5432 | Database port to connect to | |
| ssl_mode | string | prefer | SSL mode for the connection | |
| target_roles | string | Target roles for default privileges | ||
| session_role | string | Role to assume for operations | ||
| fail_on_role | bool | true | Fail when a target role is missing | |
| trust_input | bool | true | Retained compatibility option; SQL values are always quoted | |
| login_unix_socket | string | Unix socket directory | ||
| ca_cert | string | CA certificate path | ||
| ssl_cert | string | Client certificate path | ||
| ssl_key | string | Client private key path |
Example
yaml
- 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