ansible.builtin.postgresql_db (v2.3.3.0-1) — module

Add or remove PostgreSQL databases from a remote host.

| "added in version" 0.6 of ansible.builtin"

Authors: Ansible Core Team

stableinterface | supported by community

Install Ansible via pip

Install with pip install ansible==2.3.3.0.post1

Description

Add or remove PostgreSQL databases from a remote host.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Create a new database with name "acme"
- postgresql_db:
    name: acme
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Create a new database with name "acme" and specific encoding and locale
# settings. If a template different from "template0" is specified, encoding
# and locale settings must match those of the template.
- postgresql_db:
    name: acme
    encoding: UTF-8
    lc_collate: de_DE.UTF-8
    lc_ctype: de_DE.UTF-8
    template: template0

Inputs

    
name:
    default: null
    description:
    - name of the database to add or remove
    required: true

port:
    aliases:
    - login_port
    default: 5432
    description:
    - Database port to connect to.
    type: int

owner:
    default: null
    description:
    - Name of the role to set as owner of the database
    required: false

state:
    choices:
    - present
    - absent
    default: present
    description:
    - The database state
    required: false

ca_cert:
    aliases:
    - ssl_rootcert
    description:
    - 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.
    type: str

encoding:
    default: null
    description:
    - Encoding of the database
    required: false

lc_ctype:
    default: null
    description:
    - Character classification (LC_CTYPE) to use in the database (e.g. lower, upper, ...)
      Must match LC_CTYPE of template database unless C(template0) is used as template.
    required: false

ssl_mode:
    choices:
    - allow
    - disable
    - prefer
    - require
    - verify-ca
    - verify-full
    default: prefer
    description:
    - 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.
    type: str

template:
    default: null
    description:
    - Template used to create the database
    required: false

lc_collate:
    default: null
    description:
    - Collation order (LC_COLLATE) to use in the database. Must match collation order
      of template database unless C(template0) is used as template.
    required: false

login_host:
    default: ''
    description:
    - Host running the database.
    - If you have connection issues when using C(localhost), try to use C(127.0.0.1) instead.
    type: str

login_user:
    default: postgres
    description:
    - The username this module should use to establish its PostgreSQL session.
    type: str

login_password:
    default: ''
    description:
    - The password this module should use to establish its PostgreSQL session.
    type: str

login_unix_socket:
    default: ''
    description:
    - Path to a Unix domain socket for local connections.
    type: str