Deploy dbbot and Configure Ansible

dbbot has a built-in portable Ansible distribution (2.10.17), with the goal of reducing environment intrusion and version conflicts. The standard process has only two steps:

  1. Unzip dbbot.
  2. Register and verify built-in Ansible.

dbbotctl env setup does more than register aliases.

It may install or upgrade runtime dependencies on the control node, such as python3, SELinux Python bindings, and sshpass, and it also writes shell initialization files. Run it on a dedicated control node or a fresh environment whenever possible.

1. Download and unzip dbbot

cd ~
dbbot_version="$(basename "$(curl -fsSLI -o /dev/null -w '%{url_effective}' https://github.com/fanderchan/dbbot/releases/latest)")"
curl -fL -O "https://github.com/fanderchan/dbbot/releases/download/${dbbot_version}/dbbot-${dbbot_version}.tar.gz"
tar -zxvf "dbbot-${dbbot_version}.tar.gz" -C /usr/local

Recommended installation path: /usr/local. If you use wget, make sure it is installed first; minimal CentOS 7 environments usually do not include wget by default.

After decompression is complete, it is recommended to confirm the core directory first:

ls -1 /usr/local/dbbot

Typical output should contain:

  • bin
  • mysql_ansible
  • clickhouse_ansible
  • monitoring_prometheus_ansible
  • portable-ansible

It is recommended to run a local sanity check first:

/usr/local/dbbot/bin/dbbotctl version
/usr/local/dbbot/bin/dbbotctl doctor

2. Register the portable Ansible distribution

/usr/local/dbbot/bin/dbbotctl env setup
source ~/.bashrc

dbbotctl env setup wraps the built-in setup_portable_ansible.sh, installs required dependencies, and writes the following into ~/.bashrc:

  • ansible / ansible-playbook aliases
  • /usr/local/dbbot/bin prepended to PATH

On Linux control nodes, this step may also:

  • install or upgrade the system python3
  • install SELinux Python bindings
  • install or place sshpass
  • modify ~/.bashrc

Minimal CentOS 7 usually does not include python3 by default. In that case dbbotctl env setup prompts before installing python3; press Enter or type y to let dbbot install it through the system package manager and continue the setup.

Verify installation:

ansible --version

The ansible / ansible-playbook aliases are intended for interactive shells. In scripts, CI jobs, SSH one-liners, and other non-interactive contexts, the shell may not expand aliases. Prefer the explicit portable Ansible paths:

python3 /usr/local/dbbot/portable-ansible/ansible --version
python3 /usr/local/dbbot/portable-ansible/ansible-playbook --version

Expected key points:

  • Ansible version: 2.10.17
  • Python version: 3.x

3. How this portable Ansible runtime is built

The portable Ansible runtime shipped in the release package is built with make_ansible_portable using the following command:

./build.sh \
  --python /usr/bin/python3 \
  --source ansible-base==2.10.17 \
  --without-vault \
  --without-yaml-c-extension \
  --clean-output \
  --extra-collection 'ansible.posix:==1.5.4'

Meaning of the flags:

  • --python /usr/bin/python3: selects the control-node Python used for build-time work and self-tests.
  • --source ansible-base==2.10.17: selects the official ansible-base package for the 2.10 line.
  • --without-vault: removes the ansible-vault entry point plus the cryptography / cffi dependency chain; the bundle no longer supports vault features.
  • --without-yaml-c-extension: removes the compiled PyYAML extension and falls back to pure-Python YAML handling.
  • --clean-output: clears previous artifacts with the same output name before rebuilding.
  • --extra-collection 'ansible.posix:==1.5.4': embeds a pinned ansible.posix collection directly into the bundle.

Common instructions

  • dbbot’s Playbook is mainly based on Python 3 complete testing.
  • When the target machine only has Python 2, Ansible will perform compatibility processing according to the actual environment.
  • MySQL and ClickHouse subdirectories share the same control node environment, and there is no need to install multiple sets of Ansible separately.
  • If you need to inspect the underlying bootstrap script, check /usr/local/dbbot/libexec/dbbotctl/setup_portable_ansible.sh.
  • For later upgrades, prefer dbbotctl instead of deleting the old directory and restoring files manually. See dbbot Upgrade and Rollback.

Next chapter: dbbot Configuration and Single-Node Deployment Demo