community.clickhouse.clickhouse_row_policy module – Creates, removes or modify a ClickHouse row policy using the clickhouse-driver Client interface
Note
This module is part of the community.clickhouse collection (version 2.2.0).
You might already have this collection installed if you are using the ansible package.
It is not included in ansible-core.
To check whether it is installed, run ansible-galaxy collection list.
To install it, use: ansible-galaxy collection install community.clickhouse.
You need further requirements to be able to use this module,
see Requirements for details.
To use it in a playbook, specify: community.clickhouse.clickhouse_row_policy.
New in community.clickhouse 2.2.0
Synopsis
This module allows you to manage ClickHouse row policies. It can create, remove or modify row policies based on the provided parameters. The module uses the clickhouse-driver Client interface to interact with the ClickHouse database.
Requirements
The below requirements are needed on the host that executes this module.
clickhouse-driver
Parameters
Parameter |
Comments |
|---|---|
The users or roles to which the row policy applies. Default: |
|
Whether the row policy applies to all users or roles. Choices:
|
|
The users or roles to which the row policy does not apply. Can only be used if Default: |
|
Any additional keyword arguments you want to pass to the Client interface when instantiating its object. Default: |
|
The name of the cluster where the row policy is defined. If not provided, the row policy will be managed on the local server. |
|
The name of the database where the row policy is defined. |
|
The same as the If not passed, relies on the driver’s default argument value. |
|
The same as the Default: |
|
The same as the If not passed, relies on the driver’s default argument value. |
|
The same as the If not passed, relies on the driver’s default argument value. |
|
The same as the If not passed, relies on the driver’s default argument value. Be sure your the user has permissions to read the system tables listed in the RETURN section. |
|
The name of the row policy to manage. |
|
Whether the row policy is restrictive. Choices:
|
|
Whether the row policy should be present or not. If If Choices:
|
|
List of server error codes that will be treated as success, otherwise throw errors. Default: |
|
The name of the table where the row policy is defined. Can be Default: |
|
The condition that defines the row policy. This is a required parameter when |
Attributes
Attribute |
Support |
Description |
|---|---|---|
Support: full |
Supports check_mode. |
|
Support: full |
When run twice in a row outside check mode, with the same arguments, the second invocation indicates no change. |
Notes
Note
See the clickhouse-driver documentation for more information about the driver interface.
Examples
- name: Create a row policy for a specific table
community.clickhouse.clickhouse_row_policy:
name: "policy1"
database: "test_db"
table: "test_table"
using: "a = 1"
restrictive: true
apply_to: ["user1", "user2"]
- name: Create a row policy that applies to all users except one
community.clickhouse.clickhouse_row_policy:
name: "policy2"
database: "test_db"
table: "test_table"
using: "b = 1"
apply_to_all: true
apply_to_except: ["user3"]
- name: Remove a row policy
community.clickhouse.clickhouse_row_policy:
name: "policy1"
database: "test_db"
table: "test_table"
state: "absent"
- name: Create a row policy for all tables in a database
community.clickhouse.clickhouse_row_policy:
name: "policy3"
database: "test_db"
table: "*"
using: "c = 1"
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
|---|---|
Data-modifying executed statements. Returned: on success Sample: |