postgresql_schema
Add or remove PostgreSQL schema
Collection: community.postgresql
Full Name: community.postgresql.postgresql_schema
Synopsis
Add or remove PostgreSQL schema
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| login_user | str | The username this module should use to establish its PostgreSQL session. | ||
| login_password | str | The password this module should use to establish its PostgreSQL session. | ||
| login_host | str | Host running the database. If you have connection issues when using C(localhost), try to use C(127.0.0.1) instead. | ||
| login_unix_socket | str | Path to a Unix domain socket for local connections. | ||
| login_port | int | Database port to connect to. The C(port) alias is deprecated and will be removed in the next major release. Use C(login_port) instead. | ||
| ssl_mode | str | prefer | Determines whether or with what priority a secure SSL TCP/IP connection will be negotiated with the server. See U(https://www.postgresql.org/docs/current/static/libpq-ssl.html) for more information on the modes. Default of C(prefer) matches libpq default. | |
| ca_cert | str | Specifies the name of a file containing SSL certificate authority (CA) certificate(s). If the file exists, the server’s certificate will be verified to be signed by one of these authorities. | ||
| ssl_cert | path | Specifies the file name of the client SSL certificate. | ||
| ssl_key | path | Specifies the location for the secret key used for the client certificate. | ||
| connect_params | dict | Any additional parameters to be passed to libpg. These parameters take precedence. | ||
| schema | str | yes | ||
| owner | str | Name of the role to set as owner of the schema. | ||
| login_db | str | postgres | Name of the database to connect to and add or remove the schema. The V(db) alias is deprecated and will be removed in version 5.0.0. | |
| cascade_drop | bool | false | Drop schema with CASCADE to remove child objects. | |
| state | str | present | The schema state. | |
| session_role | str | Switch to session_role after connecting. The specified session_role must be a role that the current login_user is a member of. Permissions checking for SQL commands is carried out as though the session_role were the one that had logged in originally. | ||
| trust_input | bool | true | If C(false), check whether values of parameters I(schema), I(owner), I(session_role) are potentially dangerous. It makes sense to use C(false) only when SQL injections via the parameters are possible. | |
| comment | str | Sets a comment on the schema. To reset the comment, pass an empty string. |
Example
yaml
- name: Create a new schema with name acme in test database
community.postgresql.postgresql_schema:
login_db: test
name: acme
comment: 'My test schema'
- name: Create a new schema acme with a user bob who will own it
community.postgresql.postgresql_schema:
name: acme
owner: bob
- name: Drop schema "acme" with cascade
community.postgresql.postgresql_schema:
name: acme
state: absent
cascade_drop: true