postgresql_schema – Add or remove PostgreSQL schema from a remote host

From Get docs
Ansible/docs/2.7/modules/postgresql schema module


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.

Requirements

The below requirements are needed on the host that executes this module.

  • psycopg2

Parameters

Parameter Choices/Defaults Comments

database

-

Default:

"postgres"

Name of the database to connect to.

login_host

-

Default:

"localhost"

Host running the database.

login_password

-

The password used to authenticate with.

login_unix_socket

-

Path to a Unix domain socket for local connections.

login_user

-

The username used to authenticate with.

name

- / required

Name of the schema to add or remove.

owner

-

Name of the role to set as owner of the schema.

port

-

Default:

5432

Database port to connect to.

state

-

  • present

  • absent

The schema state.



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.


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, the following are the fields unique to this module:

Key Returned Description

schema

string

success, changed

Name of the schema


Sample:

acme




Status

Authors

Hint

If you notice any issues in this documentation you can edit this document to improve it.


© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.7/modules/postgresql_schema_module.html