Note
This plugin is part of the community.general collection.
To install it use: ansible-galaxy collection install community.general.
To use it in a playbook, specify: community.general.postgresql_slot.
The below requirements are needed on the host that executes this module.
| Parameter | Choices/Defaults | Comments |
|---|---|---|
| ca_cert string | 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. aliases: ssl_rootcert | |
| db string | Name of database to connect to. aliases: login_db | |
| immediately_reserve boolean |
| Optional parameter that when yes specifies that the LSN for this replication slot be reserved immediately, otherwise the default, no, specifies that the LSN is reserved on the first connection from a streaming replication client.Is available from PostgreSQL version 9.6. Uses only with slot_type=physical. Mutually exclusive with slot_type=logical. |
| login_host string | Host running the database. | |
| login_password string | The password used to authenticate with. | |
| login_unix_socket string | Path to a Unix domain socket for local connections. | |
| login_user string | Default: "postgres" | The username used to authenticate with. |
| name string / required | Name of the replication slot to add or remove. aliases: slot_name | |
| output_plugin string | Default: "test_decoding" | All logical slots must indicate which output plugin decoder they're using. This parameter does not apply to physical slots. It will be ignored with slot_type=physical. |
| port integer | Default: 5432 | Database port to connect to. aliases: login_port |
| session_role string | 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. | |
| slot_type string |
| Slot type. |
| ssl_mode string |
| Determines whether or with what priority a secure SSL TCP/IP connection will be negotiated with the server. See https://www.postgresql.org/docs/current/static/libpq-ssl.html for more information on the modes. Default of prefer matches libpq default. |
| state string |
| The slot state.
state=present implies the slot must be present in the system.
state=absent implies the groups must be revoked from target_roles. |
| trust_input boolean added in 0.2.0 of community.general |
| If no, check the value of session_role is potentially dangerous.It sense to use no only when SQL injections via session_role are possible. |
Note
postgres account on the host.See also
Complete reference of the PostgreSQL pg_replication_slots view.
Complete reference of the PostgreSQL streaming replication protocol documentation.
Complete reference of the PostgreSQL logical replication protocol documentation.
- name: Create physical_one physical slot if doesn't exist
become_user: postgres
community.general.postgresql_slot:
slot_name: physical_one
db: ansible
- name: Remove physical_one slot if exists
become_user: postgres
community.general.postgresql_slot:
slot_name: physical_one
db: ansible
state: absent
- name: Create logical_one logical slot to the database acme if doesn't exist
community.general.postgresql_slot:
name: logical_slot_one
slot_type: logical
state: present
output_plugin: custom_decoder_one
db: "acme"
- name: Remove logical_one slot if exists from the cluster running on another host and non-standard port
community.general.postgresql_slot:
name: logical_one
login_host: mydatabase.example.org
port: 5433
login_user: ourSuperuser
login_password: thePassword
state: absent
Common return values are documented here, the following are the fields unique to this module:
| Key | Returned | Description |
|---|---|---|
| name string | always | Name of the slot Sample: physical_one |
| queries string | always | List of executed queries. Sample: ["SELECT pg_create_physical_replication_slot('physical_one', False, False)"] |
© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.10/collections/community/general/postgresql_slot_module.html