Skip to content

Bulk Deployment


We can install DataKit in batches through Ansible and so on.

Preconditions

  • Installing Ansible on the management machine.
  • Configure the host file and the install.yaml /etc/ansible/ under the default configuration path of Ansible.
  • If you manage Windows machines through Ansible, refer to Ansible doc for corresponding pre-preparation.

Configuration

Ansible host file configuration examples:

[linux]
# ansible_become_pass user password is not specified as root by default, but can be specified by become_user (refer to official documents for details)
10.200.6.58    ansible_ssh_user=xxx   ansible_ssh_pass=xxx   ansible_become_pass=xxx
10.100.64.117  ansible_ssh_user=xxx   ansible_ssh_pass=xxx   ansible_become_pass=xxx

[windows]
# ansible_connection using winrm (refer to official documentation for details)
10.100.65.17 ansible_ssh_user="xxx" ansible_ssh_pass="xxx" ansible_ssh_port=5986 ansible_connection="winrm" ansible_winrm_server_cert_validation=ignore

Ansible install.yaml file configuration example:

- hosts: linux # Corresponds to the Linux machines in the host configuration file
  become: true
  gather_facts: no
  tasks:
  - name: install
    # Run the generated installation command with the DataWay address, default host collectors, and global tags.
    shell: DK_DATAWAY=https://openway.truewatch.com?token=<TOKEN> bash -c "$(curl -L https://static.truewatch.com/datakit-v2/install.sh)"
    async: 120  # Maximum task runtime in seconds; exceeding it marks the task as failed.
    poll: 10    # Polling interval in seconds. Set to 0 to start the task without waiting for its result.

- hosts: windows # Corresponds to the Windows machines in the host configuration file
  gather_facts: no
  tasks:
  - name: install
    win_shell: Remove-Item -ErrorAction SilentlyContinue Env:DK_*; $env:DK_DATAWAY="https://openway.truewatch.com?token=<TOKEN>"; Set-ExecutionPolicy Bypass -scope Process -Force; Import-Module bitstransfer; start-bitstransfer  -source https://static.truewatch.com/datakit-v2/install.ps1 -destination .install.ps1; powershell ./.install.ps1;
    async: 120
    poll: 10

Deployment

Batch deployment can be realized by running the following command on the management machine:

ansible-playbook -i hosts install.yaml