The postgres_privileges module is used to manage Postgres privileges. Privileges can be set as either absent or present.
Privileges can be set on the following database object types:
database
schema
tablespace
table
sequence
language
group
Setting the grant option is supported as well.
New in version 2016.3.0.
baruwa:
postgres_privileges.present:
- object_name: awl
- object_type: table
- privileges:
- SELECT
- INSERT
- DELETE
- grant_option: False
- prepend: public
- maintenance_db: testdb
andrew:
postgres_privileges.present:
- object_name: admins
- object_type: group
- grant_option: False
- maintenance_db: testdb
baruwa:
postgres_privileges.absent:
- object_name: awl
- object_type: table
- privileges:
- SELECT
- INSERT
- DELETE
- prepend: public
- maintenance_db: testdb
andrew:
postgres_privileges.absent:
- object_name: admins
- object_type: group
- maintenance_db: testdb
Revoke the requested privilege(s) on the specificed object(s)
Name of the role whose privileges should be revoked
Name of the object on which the revoke is to be performed
The object type, which can be one of the following:
table
sequence
schema
tablespace
language
database
group
function
View permissions should specify object_type: table.
Comma separated list of privileges to revoke, from the list below:
INSERT
CREATE
TRUNCATE
CONNECT
TRIGGER
SELECT
USAGE
TEMPORARY
UPDATE
EXECUTE
REFERENCES
DELETE
ALL
privileges should not be set when revoking group membership
Table and Sequence object types live under a schema so this should be provided if the object is not under the default public schema
The name of the database in which the language is to be installed
System user all operations should be performed on behalf of
database username if different from config or default
user password if any password for a specified user
Database host if different from config or default
Database port if different from config or default
Grant the requested privilege(s) on the specified object to a role
Name of the role to which privileges should be granted
Name of the object on which the grant is to be performed. 'ALL' may be used for objects of type 'table' or 'sequence'.
The object type, which can be one of the following:
table
sequence
schema
tablespace
language
database
group
function
View permissions should specify object_type: table.
List of privileges to grant, from the list below:
INSERT
CREATE
TRUNCATE
CONNECT
TRIGGER
SELECT
USAGE
TEMPORARY
UPDATE
EXECUTE
REFERENCES
DELETE
ALL
privileges should not be set when granting group membership
If grant_option is set to True, the recipient of the privilege can in turn grant it to others
Table and Sequence object types live under a schema so this should be provided if the object is not under the default public schema
The name of the database in which the language is to be installed
System user all operations should be performed on behalf of
database username if different from config or default
user password if any password for a specified user
Database host if different from config or default
Database port if different from config or default