Install with Ansible¶
Use the shipped Ansible playbooks when ClickHouse runs on more than one Linux host. The standard topology is one Click-Dog systemd sidecar per ClickHouse node, reading that node's local span log and exporting to a shared OTLP receiver. List every node and the fleet covers the whole cluster; the sidecars need no coordination and no ClickHouse Keeper.
The playbook manages Click-Dog itself. It does not edit ClickHouse server configuration or create the ClickHouse monitoring user; complete those prerequisites through the configuration management you already use for ClickHouse.
Prerequisites¶
On the Ansible control node:
- Ansible with SSH access to every target
- a checkout containing
deploy/ansible/ - privilege escalation (
become) on the managed hosts
On every ClickHouse host:
system.opentelemetry_span_logenabled and fillingsystem.query_logavailable- a
click_dog_monitoruser withSELECTon those two tables - network access from the host to the OTLP/gRPC receiver
The monitoring user should be created idempotently through your secured
ClickHouse administration path. Hash the same plaintext password you store in
Ansible Vault, then substitute that 64-character SHA-256 value for <hash>:
CREATE USER IF NOT EXISTS click_dog_monitor IDENTIFIED WITH sha256_hash BY '<hash>';
GRANT SELECT ON system.opentelemetry_span_log TO click_dog_monitor;
GRANT SELECT ON system.query_log TO click_dog_monitor;
Click-Dog additionally enforces readonly=2 on every connection. If the span
table does not exist, follow ClickHouse's span-log
instructions
through the same fleet configuration system before deploying Click-Dog.
1. Create the inventory¶
Copy the example and list every ClickHouse node:
cp deploy/ansible/inventory.ini.example deploy/ansible/inventory.ini
vi deploy/ansible/inventory.ini
The important shape is:
[clickhouse]
ch-node-01.example.com
ch-node-02.example.com
[clickhouse_canary]
ch-node-01.example.com
[clickhouse:vars]
clickhouse_username=click_dog_monitor
otel_collector_address=otel-collector.monitoring.internal:4317
# This collector's OTLP receiver serves plaintext; omit for a TLS receiver
otel_secure=false
# Pin the release you are rolling out
click_dog_version=vYY.MM.N
Do not commit the ClickHouse password to the inventory.
2. Store the password¶
The playbook requires clickhouse_password. Prefer an Ansible Vault file:
Give it this content:
The playbook writes the value to /etc/click-dog/.secret with mode 0600 and
sets clickhouse.password_file in the generated config. Password-bearing tasks
use no_log.
3. Deploy¶
Run the main playbook:
ansible-playbook \
-i deploy/ansible/inventory.ini \
deploy/ansible/playbook.yaml \
--extra-vars @deploy/ansible/secrets.yaml \
--ask-vault-pass
The playbook creates the runtime user, downloads and verifies the release,
writes the config and secret, validates the config, installs the systemd unit,
starts the service, and checks /healthz on every host. When it creates the
runtime user, it records that numeric identity—and a group created alongside
it—in the root-only installer state used by click-dog deploy uninstall.
Bound SSH concurrency with Ansible's -f flag:
ansible-playbook \
-i deploy/ansible/inventory.ini \
deploy/ansible/playbook.yaml \
--extra-vars @deploy/ansible/secrets.yaml \
--ask-vault-pass \
-f 10
-f 10 limits hosts in flight; it does not create completed rollout waves. To
finish one batch before starting the next, add serial: 10 at play level in
playbook.yaml.
Variables¶
| Variable | Purpose |
|---|---|
clickhouse_password |
Required monitoring-user password; pass through Vault or another protected variable source |
clickhouse_username |
ClickHouse username; default click_dog_monitor |
clickhouse_host |
Per-node ClickHouse address; default localhost |
clickhouse_port |
Native-protocol port; default 9000 |
otel_collector_address |
Shared OTLP/gRPC receiver; default localhost:4317 |
otel_secure |
OTLP transport: true for TLS, false for plaintext. Unset, each host's installed click-dog decides: plaintext for a loopback collector, TLS for any other, checked with click-dog test tls before the configuration is written. With TLS, the collector's certificate is verified against the host's system trust roots unless otel_ca_cert is set. See OTLP TLS |
otel_ca_cert |
Control-node path to the PEM CA certificate that signed the collector's server certificate, for a collector on a private CA. Implies TLS; fails with otel_secure=false |
otel_client_cert |
Control-node path to the PEM client certificate this host presents to a collector that requires mutual TLS. Requires otel_client_key; implies TLS and fails with otel_secure=false |
otel_client_key |
Control-node path to the private key for otel_client_cert; may be Vault-encrypted |
keeper_hosts |
Optional Keeper hosts for fleet coordination: cluster-wide click-dog flush and /clusterz. Unset by default, which renders no ha: block; not needed for coverage |
click_dog_version |
Release tag; default latest, which each host resolves separately, so pin one tag for a fleet rollout |
click_dog_local_binary |
Pre-verified binary copied from the control node |
click_dog_download_url |
Mirrored archive URL; requires click_dog_download_checksum |
click_dog_download_checksum |
Trusted SHA-256 for a mirrored archive |
click_dog_dangerously_ignore_cosign |
Explicitly allow checksum-only official-release verification |
Inventory variables or a protected variable file can override the defaults.
Every host gets the same configuration from
deploy/ansible/templates/click-dog.yaml.j2: the production profile that
click-dog init writes, with each host's connection and secret, plus the
optional TLS and Keeper settings, filled in. To change a threshold or filter for the whole fleet, edit
that template before deploying.
OTLP TLS¶
Each host the playbook configures is the host that exports, so it decides the
transport there, the way install.sh install does:
otel_secureunset: the playbook asks the click-dog binary it just installed (click-dog init --print-otel-secure). A loopback collector, such as the defaultlocalhost:4317per-node Agent, gets plaintext, and the configuration carries a comment stating the transport rule instead of asecurekey. Any other collector gets TLS: the playbook runsclick-dog test tlson the host, againstotel_ca_certwhen set, before writing the configuration, and fails the host on a definite mismatch. A receiver that serves plaintext fails it withotel_secure=falsenamed as the fix; an inconclusive check, such as an unreachable receiver, is a note.otel_secure=true: rendered assecure: true, with the sameclick-dog test tlscheck.otel_secure=false: rendered assecure: false, with no check. Use it for a remote OpenTelemetry Collector or Datadog Agent whose OTLP receiver serves plaintext, as both do on 4317 unless TLS is configured.
With TLS, Click-Dog verifies the collector's server certificate against the
host's system trust roots, which is all a collector with a publicly trusted
certificate needs. Certificate material (otel_ca_cert, otel_client_cert,
otel_client_key) implies TLS; the run fails before changing the host when
it is set together with otel_secure=false.
For a collector on a private CA, or one that requires clients to present a certificate, keep the PEM files on the control node and name them in the inventory. Ansible templates inventory values, so one line can give every node its own client certificate:
[clickhouse:vars]
otel_secure=true
# CA that signed the collector's server certificate
otel_ca_cert=/secure/pki/otel-collector-ca.pem
# Mutual TLS: one client certificate per node, issued by a CA the collector trusts
otel_client_cert=/secure/pki/{{ inventory_hostname }}.crt
otel_client_key=/secure/pki/{{ inventory_hostname }}.key
The playbook copies them to /etc/click-dog/tls/ca.pem and client.crt
(mode 0640) and client.key (mode 0600), owned by the runtime user,
before it writes the configuration, and renders the matching ca_cert,
client_cert, and client_key. Ansible decrypts Vault-encrypted source files
as it copies them, so the key can stay encrypted on the control node. To
rotate the client certificate, replace the source files and re-run the
playbook: Click-Dog presents the new pair on its next connection to the
collector, without a restart. A changed ca.pem restarts the service, because
the CA is read only at startup.
The playbook never deletes these three files. If one is already on a host but
its variable is unset, such as the ca.pem a guided install writes to trust a
private collector CA, the run stops before changing anything. Set the
variable, or remove the file from the host; without ca.pem, the collector is
verified against the system trust roots.
Client certificates need the TLS Web Client Authentication extended key usage.
Let's Encrypt stopped issuing it in 2026, and collectors built on Go's TLS
stack, including the OpenTelemetry Collector, reject a client certificate
without it, so issue client certificates from your own CA. For the
same reason the playbook no longer accepts tls_enabled, which requested a
Let's Encrypt certificate on each host; see the changelog.
Canary rollout¶
Put the first rollout hosts in a clickhouse_canary group, then run the shipped
canary playbook:
ansible-playbook \
-i deploy/ansible/inventory.ini \
deploy/ansible/playbook-canary.yaml \
--extra-vars @deploy/ansible/secrets.yaml \
--ask-vault-pass \
-f 10
It deploys canaries first, requires the service and /readyz to become healthy,
waits five minutes by default, then proceeds to the remaining fleet. Override
the soak with canary_soak_minutes.
Scale out from one host¶
A host set up with the guided install uses the same binary, configuration, secret, and service paths as the playbook, so the playbook can take it over and add the remaining nodes:
- Put the existing host's monitoring password in the Vault file from
step 2. The guided install generated it, and it is
stored only in
/etc/click-dog/.secreton that host; the playbook overwrites that file with the Vault value. - On every new node, enable the span log and create
click_dog_monitorwith the grants in Prerequisites, using that password. - Compare
/etc/click-dog/click-dog.yamlon the existing host withdeploy/ansible/templates/click-dog.yaml.j2and copy any tuning you want to keep into the template. The playbook replaces the existing file with the rendered template. - Carry over its collector TLS as inventory variables, because the template
takes TLS from them, not from the existing file. If the existing config sets
secure: true, setotel_secure=true. If it names/etc/click-dog/tls/ca.pem, copy that file to the control node and setotel_ca_certto the copy; the playbook stops rather than drop a CA the inventory does not supply. See OTLP TLS. - List every node under
[clickhouse], including the existing host, and put the existing host in[clickhouse_canary]. - Run the canary rollout. The existing host is redeployed
first and must pass
/readyzbefore any other node is installed.
The template never sets use_cluster_queries, so a host running in cluster
mode becomes a sidecar like the rest of the fleet. Leaving a cluster-mode
instance running beside sidecars would export the same spans twice.
Verify the fleet¶
The playbook checks each host during deployment. For a later status pass:
ansible clickhouse \
-i deploy/ansible/inventory.ini \
--become \
-m command \
-a "/usr/local/bin/click-dog deploy status"
Follow recent service logs across the fleet with your normal log aggregation, or inspect a host directly:
Update and roll back¶
Resolve one version and pass it to every host:
LATEST_URL="$(curl -fsSL -o /dev/null -w '%{url_effective}' \
https://github.com/coltconsulting/click-dog/releases/latest)" || exit 1
VERSION="${LATEST_URL##*/}"
ansible-playbook \
-i deploy/ansible/inventory.ini \
deploy/ansible/playbook.yaml \
--extra-vars @deploy/ansible/secrets.yaml \
--extra-vars "click_dog_version=${VERSION}" \
--ask-vault-pass \
-f 10
The playbook copies the outgoing binary to click-dog.prev before replacing
it. Roll back the most recent update with:
ansible-playbook \
-i deploy/ansible/inventory.ini \
deploy/ansible/playbook.yaml \
--extra-vars @deploy/ansible/secrets.yaml \
--ask-vault-pass \
--tags rollback
Only one previous binary is retained. See Updating for the shared version and configuration contract.
Air-gapped and mirrored releases¶
For an air-gapped fleet, verify and extract the binary on a connected host,
then set click_dog_local_binary to its path on the control node:
ansible-playbook \
-i deploy/ansible/inventory.ini \
deploy/ansible/playbook.yaml \
--extra-vars @deploy/ansible/secrets.yaml \
--extra-vars "click_dog_local_binary=/secure/staging/click-dog" \
--ask-vault-pass
This bypasses automatic download because the supplied binary is already your
verified input. For an internal mirror, set both click_dog_download_url and a
trusted click_dog_download_checksum; the playbook refuses a custom URL
without its SHA-256. See Verify releases.
Remove the fleet deployment¶
Run the installed uninstaller on every managed host:
ansible clickhouse \
-i deploy/ansible/inventory.ini \
--become \
-m command \
-a "/usr/local/bin/click-dog deploy uninstall --yes"
This permanently removes each standard systemd installation, including its
configuration and credentials. An OS user or group is removed only when the
installer or Ansible playbook's root-owned metadata proves it created that exact
numeric identity; pre-provisioned accounts are preserved. Repeating this command
after a successful removal is a successful no-op. If the OS refuses to remove
a proven runtime identity, the command exits nonzero after removing the managed
Click-Dog files and reports the account or group retained for manual cleanup.
Resolve that identity before removing the hosts from inventory; a repeated
--yes confirms the managed installation is absent but does not retry account
deletion after its ownership metadata has been removed.