community.clickhouse.clickhouse_info module – Gather ClickHouse server information using the clickhouse-driver Client interface

Note

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

New in community.clickhouse 0.1.0

Synopsis

  • Gather ClickHouse server information using the clickhouse-driver Client interface.

  • Does not change server state.

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: {}

limit

list / elements=string

added in community.clickhouse 0.2.0

Limits a set of return values you want to get.

See the Return section for acceptable values.

If not specified, returns all supported return values.

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.

Attributes

Attribute

Support

Description

check_mode

Support: full

Supports check_mode.

Notes

Note

  • See the clickhouse-driver documentation for more information about the driver interface.

Examples

- name: Get server information
  register: result
  community.clickhouse.clickhouse_info:
    login_host: localhost
    login_user: alice
    login_db: foo
    login_password: my_password

- name: Print returned data
  ansible.builtin.debug:
    var: result

- name: Limit return values with users and roles
  register: result
  community.clickhouse.clickhouse_info:
    limit:
      - users
      - roles

Return Values

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

Key

Description

clusters

dictionary

The content of the system.clusters table with names as keys.

Returned: success

Sample: {"test_cluster_two_shards": "..."}

databases

dictionary

The content of the system.databases table with names as keys.

Be sure your login_user has permissions.

Returned: success

Sample: {"system": "..."}

dictionaries

dictionary

added in community.clickhouse 0.3.0

The content of the system.dictionaries table with dictionary names as keys.

Returned: success

Sample: {"database": {"dictionary": "..."}}

driver

dictionary

Python driver information.

Returned: success

Sample: {"version": "0.2.6"}

grants

dictionary

added in community.clickhouse 0.7.0

The content of the system.grants table for users and roles as keys.

Returned: success

Sample: {"roles": {"...": null}, "users": {"...": null}}

merge_tree_settings

dictionary

added in community.clickhouse 0.3.0

The content of the system.merge_tree_settings table with names as keys.

Returned: success

Sample: {"merge_max_block_size": "..."}

quotas

dictionary

added in community.clickhouse 0.4.0

The content of the system.quotas table with quota names as keys.

Returned: success

Sample: {"default": "..."}

roles

dictionary

The content of the system.roles table with names as keys.

Be sure your login_user has permissions.

Returned: success

Sample: {"accountant": "..."}

settings

dictionary

The content of the system.settings table with names as keys.

Returned: success

Sample: {"zstd_window_log_max": "..."}

settings_profile_elements

dictionary

added in community.clickhouse 0.7.0

The content of the system.settings_profile_elements table for users, roles, profiles as keys.

Returned: success

Sample: {"profiles": {"...": null}, "roles": {"...": null}, "users": {"...": null}}

settings_profiles

dictionary

added in community.clickhouse 0.4.0

The content of the system.settings_profiles table with profile names as keys.

Returned: success

Sample: {"readonly": "..."}

storage_policies

dictionary

added in community.clickhouse 0.4.0

The content of the system.storage_policies table with storage_policies names as keys.

Returned: success

Sample: {"storage_policies": "..."}

tables

dictionary

added in community.clickhouse 0.3.0

The content of the system.tables table with the table names as keys.

Returned: success

Sample: {"system": {"settings": "..."}}

users

dictionary

The content of the system.users table with names as keys.

Be sure your login_user has permissions.

Returned: success

Sample: {"default": "..."}

version

dictionary

Clickhouse server version.

Returned: success

Sample: {"build": 59, "feature": 12, "maintenance": 2, "raw": "23.12.2.59", "type": null, "year": 23}

Authors

  • Andrew Klychkov (@Andersson007)

  • Aleksandr Vagachev (@aleksvagachev)