How to Automate Enterprise Application Monitoring with Ansible – Part II

In the first part of this series, I shared practical advice on how to automatically deploy OneAgents into distributed enterprise applications using Ansible in less than 60 seconds. While we had conveniently assumed its presence back then, we will today address the automated installation of our Dynatrace Application Monitoring solution comprising Clients, Collectors and a Server into a production environment.

The Dynatrace Application Monitoring Architecture

Dynatrace Components Overview
Components of a Dynatrace installation: Client, Collector and Server

An installation of our Dynatrace Application Monitoring solution consists of an arbitrary number of Clients, multiple Collectors and a Server. Performance data are stored in an external Performance Warehouse database. If you want to know more about the various components, please refer to our Dynatrace Community.

With the upcoming release of Dynatrace 6.2, you have the possibility to tie together your Dynatrace installation with an existing Performance Warehouse database via a REST API which has been integrated into our Ansible deployment scripts for your convenience. In the following example, I assume the presence of a PostgreSQL database named dynatrace-pwh on a host of the same name that is accessible via the user dynatrace. Of course, you may as well choose from the many available roles on Ansible Galaxy for automatically provisioning Postgres.

Automated Deployment of Dynatrace

Now, let’s have a look at how the automated installation of Dynatrace could be enforced. If you are new to Ansible, please stop now and read about the basic concepts in my previous article.

#1: Define an Ansible Inventory

#2: Define an Ansible Playbook

#3: Get Roles from Ansible Galaxy

Create a file requirements.txt with the content below and download the dependencies into the roles directory via ansible-galaxy install -p roles -r requirements.txt:

#4: Run the Ansible Playbook

Finally, we execute our playbook via ansible-playbook -i production playbook.yml. At the end of the run, Ansible will present you an overview of actions taken and any errors which have occurred:

ansible-playbook –i production playbook.yml

PLAY [dynatrace-server] *************************************************************
PLAY [dynatrace-collectors] *********************************************************
PLAY [dynatrace-clients] ************************************************************
PLAY RECAP ************************************************************************** ok=39 changed=25 unreachable=0   failed=0
workstation0:          ok=14 changed=13 unreachable=0   failed=0
workstation1:          ok=14 changed=13 unreachable=0   failed=0
workstation2:          ok=14 changed=13 unreachable=0   failed=0
workstation99:         ok=14 changed=13 unreachable=0   failed=0       ok=25 changed=15 unreachable=0   failed=0 

At this point, we have successfully deployed the Dynatrace Application Monitoring solution into a production environment and have configured it to connect to a particular Performance Warehouse database. We are now ready to receive data from the OneAgents and can almost instantaneously look at a wealth of out-of-the-box insights in a Dynatrace Client:

Example of an Out-Of-The-Box Dashboard in Dynatrace: PurePaths
Example of an Out-Of-The-Box Dashboard in Dynatrace: A PurePath

Please note that the Ansible roles we used in our examples support a variety of variables whose default values you will typically want to override to suit your environment. More in-depth information on the available roles can be found in our Tutorials on Automated Deployments with Ansible.


Configuration management and deployment of a full-fledged application monitoring solution that delivers actionable insights at enterprise scale has never been easier. Keep watching out for further updates as we keep improving automated installations and configurations of our solution. If you are new to Dynatrace, check out the Dynatrace Free Trial.

Additional Resources