PARALLAX

postgresql_schema

Add or remove PostgreSQL schema

Collection: community.postgresql

Full Name: community.postgresql.postgresql_schema

Synopsis

Add or remove PostgreSQL schema

Parameters

NameTypeRequiredDefaultDescription
login_userstrThe username this module should use to establish its PostgreSQL session.
login_passwordstrThe password this module should use to establish its PostgreSQL session.
login_hoststrHost running the database. If you have connection issues when using C(localhost), try to use C(127.0.0.1) instead.
login_unix_socketstrPath to a Unix domain socket for local connections.
login_portintDatabase 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_modestrpreferDetermines 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_certstrSpecifies 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_certpathSpecifies the file name of the client SSL certificate.
ssl_keypathSpecifies the location for the secret key used for the client certificate.
connect_paramsdictAny additional parameters to be passed to libpg. These parameters take precedence.
schemastryes
ownerstrName of the role to set as owner of the schema.
login_dbstrpostgresName 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_dropboolfalseDrop schema with CASCADE to remove child objects.
statestrpresentThe schema state.
session_rolestrSwitch 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_inputbooltrueIf 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.
commentstrSets 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
Search
    ↑ ↓ move↵ openesc close