Skip to content

semrush/ansible-role-clickhouse

Repository files navigation

Yet Another Ansible Role For ClickHouse

Prerequisites

  • ClickHouse v23.5 (note: yes, it could be relaxed, but I just don't think that it worth it)
  • Ansible 2.11+

Version requirement changelog

It is better to use the latest ClickHouse stable release.

Details can be read here.

Getting started

For a basic standalone setup it is enough to do the following:

Add requirements:

# requirements.yml
---
roles:
- name: clickhouse
  scm: git
  src: [email protected]:semrush/ansible-role-clickhouse.git
  version: 1.0.0

It is also recommended to add role to .gitignore (or install it outside of the repository), this will allow to keep things clean, i.e. you will not randomly edit the roles file and later ansible-galaxy may overwrite them (though there is one exception to this rule - ansible-pull):

# .gitignore
/roles/clickhouse

And install the role:

ansible-galaxy install -r requirements.yml -p roles clickhouse

Add a simple playbook:

# clickhouse.yml
---
- name: Install ClickHouse
  hosts: all
  gather_facts: yes
  roles:
    - clickhouse

And run ansible:

ansible-playbook --become --diff clickhouse.yml
# ansible-playbook --become --diff -i CLICKHOUSE_HOST, clickhouse.yml

Here is an example patch, or the folder itself

See this page.

Key features

  • Developed with extensibility in mind (at least I hope)

  • Using YAML for configurations, and even though the syntax somewhere is tricky, it shows itself good.

    For instance jinja2 natively render dict in YAML, so we don't need to add additional loops over keys/values in the templates.

  • Provide sane defaults:

    • Enabled *_log tables by default - usual problem for existing roles is that they have a copy of config.xml from a specific point in time, and don't have new system tables.

    • TTL for *_log tables

    • Enabled prometheus exported by default

    • Has extra metrics via http_handlers

See this page.

See this page.

See this page.

See this page.

Question? Problem?

You can create an issue here.

Adopters

Please, add yourself to the adopters list (just send us merge request)!