Install Instana on IBM Cloud using Terraform and Ansible

Eduardo Patrocinio
3 min readAug 30, 2021

--

Introduction

Instana is a fantastic APM tool and super easy to install. The steps described at https://www.instana.com/docs/self_hosted_instana/installation are straightforward, and you can get an Instana running in less than an hour!

However, it assumes you have a VM created. Not a big deal, but it adds up to the sequence of steps you need to follow.

In this blog, I will show you how to install Instana on IBM Cloud. First, I use Terraform to create the VM, then Ansible to configure it.

Obtain the scripts

The first step is to retrieve the automation scripts by cloning a git repository:

git clone https://github.com/patrocinio/install-instana.git
cd install-instana

Generate an IBM Cloud API Key

If you don’t have an IBM Cloud API Key, follow the procedure described at https://cloud.ibm.com/docs/account?topic=account-userapikey#create_user_key to obtain a key.

Configure properties

Next, you need to configure the API Key and the desired resource prefix.

First, copy the template file:

cp .envrc-template .envrc

Then edit the .envrc file to define the following keys:

  • IC_API_KEY
  • RESOURCE_PREFIX
  • SALES_ID
  • AGENT_KEY

Generate the SSH Key

Instana requires an SSH Key, so run the following command to generate it:

make create-ssh-key

This command will update the .envrc file to contain the SSH Key used in the Terraform script.

Finally, load this file in your shell:

. ./.envrc

Prepare for Instana

Now, you are ready to install Instana:

make prepare

This command will create a VM in IBM Cloud, then get ready to install Instana. In the end, you should see an output like this:

[...]
TASK [Generate hostname] ************************************************************************************************************************************************
changed: [patro-instana-idea] => {"changed": true, "msg": "1 replacements made"}
TASK [Replace Sales ID] *************************************************************************************************************************************************
changed: [patro-instana-idea] => {"changed": true, "msg": "1 replacements made"}
TASK [Replace Agent Key] ************************************************************************************************************************************************
changed: [patro-instana-idea] => {"changed": true, "msg": "2 replacements made"}
PLAY RECAP **************************************************************************************************************************************************************
patro-instana-idea : ok=13 changed=5 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0

Install Instana

We are now ready to install Instana. As the process might take about 30 mins or so, I decided to do it outside the ansible process to follow the execution.

Run the following command to log in to the VM:

make ssh

You should now be logged to the VM. Run the following command to install Instana:

instana init -f settings.hcl -y --force

You will see the following output:

# instana init -f settings.hcl -y --force
docker has 16 cpus available. From release 209 this will be the minimum numbers of CPU required to start instana.
Setup host environment ✓
Handle certificates ✓
Ensure images ✓
Clean docker containers ✓
Check data directories ✓
Create configurations ✓
Run data stores ✓
Migrate data stores ✓
Run components ✓
Check components ✓
Setup environment urls ✓
Run nginx ✓
Initialize tenant unit ✓
Welcome to the World of Automatic Infrastructure and Application Monitoringhttps://XXXX
E-Mail: admin@instana.local
Password: XXXX

Configure the Instana license

We are almost done… The last step is to configure the Instana license, by running the following command:

instana license download

You will see the following output:

# instana license download
Download license ✓

Finally run the following command to import the license:

instana license import -f /root/license

You will see the following output:

instana license import -f /root/license
Import license ✓
License is successfully imported

Now you are ready to enjoy your Instana environment!

Conclusion

This article showed how to install Instana on IBM Cloud, using a script that combines Terraform and Ansible.

--

--