community.clickhouse.clickhouse_settings_profile module – Creates, removes or modify a ClickHouse settings profile using the clickhouse-driver Client interface

Note

This module is part of the community.clickhouse collection (version 2.3.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_settings_profile.

New in community.clickhouse 2.3.0

Synopsis

  • Creates, remove or modify a ClickHouse settings profile using the clickhouse-driver Client interface.

Requirements

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

  • clickhouse-driver

Parameters

Parameter

Comments

client_kwargs

dictionary

Any additional keyword arguments you want to pass to the Client interface when instantiating its object.

Default: {}

cluster

string

The name of the cluster where the row policy is defined. If not provided, the row policy will be managed on the local server.

login_db

string

The same as the Client(database='...') argument.

If not passed, relies on the driver’s default argument value.

login_host

string

The same as the Client(host='...') argument.

Default: "localhost"

login_password

string

The same as the Client(password='...') argument.

If not passed, relies on the driver’s default argument value.

login_port

integer

The same as the Client(port='...') argument.

If not passed, relies on the driver’s default argument value.

login_user

string

The same as the Client(user='...') argument.

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.

name

string / required

The name of the row policy to manage.

profiles

list / elements=string

List of profiles assigned to an object.

settings

dictionary

Settings assigned to an object.

Settings are passed as dict where key is the setting name.

Each setting takes the following options value, min, max, writability.

max

string

Maximum allowed value for the setting.

min

string

Minimum allowed value for the setting.

value

string / required

The value for the setting.

writability

string

Whether the setting can be changed.

Example values you can found profiles

state

string

Whether the settings profile should be present or not.

If present, the module will create or update the settings profile to match the provided parameters.

If absent, the module will remove the settings profile if it exists.

Choices:

  • "present" ← (default)

  • "absent"

success_on

list / elements=integer

added in community.clickhouse 2.2.0

List of server error codes that will be treated as success, otherwise throw errors.

Default: [497]

Attributes

Attribute

Support

Description

check_mode

Support: full

Supports check_mode.

idempotent

Support: partial

Module can’t determine what data type is certain setting. So when passing setting that will be resolved by server to another value module will be not idempotent. For example passing 1G as value server will store this as 100000000.

Notes

Note

Examples

---
- name: Create plain settings profile
  community.clickhouse.clickhouse_settings_profile:
    name: test_profile

- name: Create settings profile with setting
  community.clickhouse.clickhouse_settings_profile:
    name: test_profile
    settings:
      max_threads:
        value: 1

- name: Create settings profile with settings
  community.clickhouse.clickhouse_settings_profile:
    name: test_profile
    settings:
      max_threads:
        value: 1
      max_memory_usage:
        value: 10000000000

- name: Create settings profile with profiles
  community.clickhouse.clickhouse_settings_profile:
    name: test_profile
    profiles:
      - web

- name: Create settings profile with settings and profiles
  community.clickhouse.clickhouse_settings_profile:
    name: test_profile
    settings:
      max_threads:
        value: 1
      max_memory_usage:
        value: 10000000000
    profiles:
      - web
- name: Drop settings profile
  community.clickhouse.clickhouse_settings_profile:
    name: test_profile
    state: absent

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key

Description

executed_statements

list / elements=string

Data-modifying executed statements.

Returned: on success

Sample: ["CREATE SETTINGS PROFILE `test_profile` SETTINGS INHERIT `inh_1`, max_threads='1'", "ALTER SETTINGS PROFILE `test_profile` SETTINGS INHERIT `inh_1`, max_threads='1'", "DROP SETTINGS PROFILE `test_profile`"]

Authors

  • Rafal Kozlowski (@rkozlo)