ansible / ansible.builtin / v2.9.24 / module / postgresql_tablespace Add or remove PostgreSQL tablespaces from remote hosts | "added in version" 2.8 of ansible.builtin" Authors: Flavien Chantelot (@Dorn-), Antoine Levy-Lambert (@antoinell), Andrew Klychkov (@Andersson007) preview | supported by communityansible.builtin.postgresql_tablespace (v2.9.24) — module
pip
Install with pip install ansible==2.9.24
Adds or removes PostgreSQL tablespaces from remote hosts.
- name: Create a new tablespace called acme and set bob as an its owner postgresql_tablespace: name: acme owner: bob location: /data/foo
- name: Create a new tablespace called bar with tablespace options postgresql_tablespace: name: bar set: random_page_cost: 1 seq_page_cost: 1
- name: Reset random_page_cost option postgresql_tablespace: name: bar set: random_page_cost: reset
- name: Rename the tablespace from bar to pcie_ssd postgresql_tablespace: name: bar rename_to: pcie_ssd
- name: Drop tablespace called bloat postgresql_tablespace: name: bloat state: absent
db: aliases: - login_db description: - Name of database to connect to and run queries against. type: str set: description: - Dict of tablespace options to set. Supported from PostgreSQL 9.0. - For more information see U(https://www.postgresql.org/docs/current/sql-createtablespace.html). - When reset is passed as an option's value, if the option was set previously, it will be removed. type: dict port: aliases: - login_port default: 5432 description: - Database port to connect to. type: int owner: description: - Name of the role to set as an owner of the tablespace. - If this option is not specified, the tablespace owner is a role that creates the tablespace. type: str state: choices: - absent - present default: present description: - Tablespace state. - I(state=present) implies the tablespace must be created if it doesn't exist. - I(state=absent) implies the tablespace must be removed if present. I(state=absent) is mutually exclusive with I(location), I(owner), i(set). - See the Notes section for information about check mode restrictions. type: str 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 location: aliases: - path description: - Path to the tablespace directory in the file system. - Ensure that the location exists and has right privileges. type: path 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 rename_to: description: - New name of the tablespace. - The new name cannot begin with pg_, as such names are reserved for system tablespaces. 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 tablespace: aliases: - name description: - Name of the tablespace to add or remove. required: true type: str session_role: description: - 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. 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
location: description: Path to the tablespace in the file system. returned: always sample: /incredible/fast/ssd type: str newname: description: New tablespace name returned: if existent sample: new_ssd type: str options: description: Tablespace options. returned: always sample: random_page_cost: 1 seq_page_cost: 1 type: dict owner: description: Tablespace owner. returned: always sample: Bob type: str queries: description: List of queries that was tried to be executed. returned: always sample: - CREATE TABLESPACE bar LOCATION '/incredible/ssd' type: str state: description: Tablespace state at the end of execution. returned: always sample: present type: str tablespace: description: Tablespace name. returned: always sample: ssd type: str