Dynatrace provides an Ansible collection that you can use to orchestrate OneAgent deployment in your environment.
- OneAgent version 1.199+
- Dynatrace version 1.204+
- PaaS token to download the collection
- Ansible 2.9.0+
- In case of deployment on a Windows platform,
pywinrmversion 0.4.1+. is required.
pywinrmis the Python client for the Windows Remote Management (WinRM) service.
- Supported on Windows, Linux and AIX.
- OneAgent Ansible collection is released as a Preview.
Select Deploy Dynatrace from the navigation menu and then select Start installation.
Select Ansible collection to download the collection tarball.
This is a safe archive hosted in your environment.
Optional On Linux, you can verify the authenticity of the archive using the detached signature file.
- Select Signature to download the
- Make sure the downloaded Ansible collection tarball and the signature file are stored in the same directory.
- Navigate to the directory where you saved the files and run the following command:
The successful verification results in a following output
wget https://ca.dynatrace.com/dt-root.cert.pem; openssl cms \ -verify -binary \ -in dynatrace-oneagent-ansible-188.8.131.5200101-060000.tar.gz.sig \ -inform PEM \ -content dynatrace-oneagent-ansible-184.108.40.20600101-060000.tar.gz \ -CAfile dt-root.cert.pem >/dev/null
--2020-09-25 12:40:47-- https://ca.dynatrace.com/dt-root.cert.pem Resolving ca.dynatrace.com (ca.dynatrace.com)... 220.127.116.11, 18.104.22.168, 22.214.171.124, ... Connecting to ca.dynatrace.com (ca.dynatrace.com)|126.96.36.199|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 2172 (2.1K) [application/x-pem-file] Saving to: ‘dt-root.cert.pem’ dt-root.cert.pem 100%[========================>] 2.12K --.-KB/s in 0s 2020-09-25 12:40:48 (102 MB/s) - ‘dt-root.cert.pem’ saved [2172/2172] Verification successful
Save the collection
Save the collection tarball to a directory on your Ansible cluster.
Navigate to the directory where you saved the collection tarball and run the following command:
ansible-galaxy collection install dynatrace-oneagent-ansible-188.8.131.5200101-060000.tar.gz
This will install
dynatrace.oneagent collection that consist of a single role that deploys OneAgent using dedicated configuration and ensuring the OneAgent service maintains a running state. For more information, see Using collections in Ansible documentation.
Tha Ansible script requires access to the OneAgent installer. Depeneding on whether your Ansible cluster has access to your Dynatrace environment, you can either
- configure the script to download the installer directly from your Dynatrace environment,
- download it yourself and upload it to the primary node.
Direct download from your environment
The script utilizes Deployment API to download a platform-specific installer to the target machine. You will need to specify the variables to supply the role with information required to authenticate the API call in your environment:
- The PaaS token of your environment
# Set environment variables oneagent_environment_url: 'https://your-environment.live.dynatrace.com' oneagent_paas_token: 'abcdefjhij1234567890'
- The PaaS token of your environment
It's recommended to save credentials in a secure file, that can be called in your playbook using
vars_files property. See Examples.
You can use the Dynatrace UI to download OneAgent and then upload it to a directory on the primary node. Use the
local_installer variable to point the script to the directory. For example,
oneagent_local_installer: aix: /path/to/dynatrace-aix-installer.sh linux: /path/to/dynatrace-linux-installer.sh win32nt: /path/to/dynatrace-windows-installer.msi
The script copies the installer to target machines during execution.
Note that Windows, Linux, and AIX require their dedicated installers. Original installer names indicate the target platform. If you need to change the installer names, make sure the script can distinguish them. If you don't specify the installer, the script attempts to use the direct download.
The following variables are available in the
defaults/main/ file. If necessary, you can override them in your playbooks:
||unset||✔️||URL of the target Dynatrace environment (SaaS or Managed).|
||unset||✔️||The PaaS token retrieved from the "Deploy Dynatrace" installer page.|
||unset||✔️||Dictionary of paths to local installer, available keys are:
||Enables installer's signature verification after downloading it from the environment. Not supported on Windows.|
|Specifies the installer architecture|
||The required version of the OneAgent in 184.108.40.20600714-111723 format.|
|Installer's download directory. The directory must be available to the script. For Linux and AIX, the directory must not contain spaces.|
||unset||Dynatrace OneAgent installation parameters defined as a list of items.|
||Preserves installers on secondary machines after deployment.|
||OneAgent package state; use
1 Depending on the way your script accesses the OneAgent installer, one of the two is required:
This example playbook
- downloads the OneAgent installer in a specific version (
oneagent_version) and saves it to a custom directory (
vars_filesproperty points to a secure
credentials.ymlfile that stores your Environment ID and PaaS token
- instructs the script to deploy OneAgent to the
linux_otherin your inventory
- instructs the script to use the
oneagent_install_argsto pass the OneAgent installation parameters that assign the hosts to the
My.HostGroup_123-456host group and
my.network.zonenetwork zone, and enable the Infrastructure Monitoring mode.
- name: Download OneAgent installer in specific version to a custom directory with additional OneAgent install parameters hosts: linux_other collections: - dynatrace.oneagent # File contains variables oneagent_environment_url and oneagent_paas_token that needs to be stored securely vars_files: - credentials.yml vars: oneagent_installer_arch: ppcle oneagent_download_dir: /home/user1 oneagent_version: 220.127.116.1100714-111723 oneagent_install_args: - –-set-host-group=My.HostGroup_123-456 - --set-network-zone=my.network.zone - --set-infra-only=true tasks: - import_role: name: oneagent
You can find more example playbooks in the
examples directory within the role. The directory contains the following playbooks:
local_installer.yml- basic configuration with local installers.
host_properties.yml- showing the way of setting custom properties.
advanced_config.yml- showing advanced configuration as in example above.
example_inventory.yml file contains basic hosts configuration for playbooks.
Note: For multi-platform Windows, Linux or AIX deployment, you must specify the
become: true option for proper machines group in the inventory file. On Windows,
become: true option is not supported.
Since Windows paths are different than on a Linux system, see Path Formatting for Windows to avoid issues related to paths.