Documentation

postgresql_schema - Add or remove PostgreSQL schema from a remote host

New in version 2.3.

Synopsis

  • Add or remove PostgreSQL schema from a remote host.

Options

parameter required default choices comments
database
no postgres
Name of the database to connect to.
login_host
no localhost
Host running the database.
login_password
no
The password used to authenticate with.
login_unix_socket
no
Path to a Unix domain socket for local connections.
login_user
no
The username used to authenticate with.
name
yes
Name of the schema to add or remove.
owner
no
Name of the role to set as owner of the schema.
port
no 5432
Database port to connect to.
state
no present
  • present
  • absent
The schema state.

Examples

# Create a new schema with name "acme"
- postgresql_schema:
    name: acme

# Create a new schema "acme" with a user "bob" who will own it
- postgresql_schema:
    name: acme
    owner: bob

Return Values

Common return values are documented here Return Values, the following are the fields unique to this module:

name description returned type sample
schema Name of the schema success, changed string acme


Notes

Note

  • This module uses psycopg2, a Python PostgreSQL database adapter. You must ensure that psycopg2 is installed on the host before using this module. If the remote host is the PostgreSQL server (which is the default case), then PostgreSQL must also be installed on the remote host. For Ubuntu-based systems, install the postgresql, libpq-dev, and python-psycopg2 packages on the remote host before using this module.

Status

This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.

Support

This module is community maintained without core committer oversight.

For more information on what this means please read Module Support

For help in developing on modules, should you be so inclined, please read Community Information & Contributing, Helping Testing PRs and Developing Modules.