Skip to content

Commit

Permalink
Merge pull request #2 from Dynatrace/Installer_Script_URL
Browse files Browse the repository at this point in the history
New OneAgent installation approach
  • Loading branch information
BlazejT authored Oct 11, 2017
2 parents 52ffb49 + 4f10ec1 commit 55071f3
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 18 deletions.
9 changes: 6 additions & 3 deletions .kitchen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,13 @@ provisioner:
require_ansible_omnibus: true

driver:
name: docker
name: vagrant

platforms:
- name: debian
- name: debian/jessie64

suites:
- name: default
- name: default

transport:
max_ssh_sessions: 6
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
source 'https://rubygems.org'
gem 'kitchen-ansible', '>=0.0.25'
gem 'kitchen-docker', '>=2.3.0'
gem 'kitchen-vagrant', '>=1.2.1'
gem 'test-kitchen', '>=1.4.2'
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,16 @@ You can get your url by following these steps:
1. Select **Deploy Dynatrace** from the navigation menu.
2. Click the **Start installation** button.
3. For **Linux**
- Locate your `oneagent_installer_script_url`, as shown below.
![Alt text](https://user-images.githubusercontent.com/23307837/31234263-bf223030-a9ee-11e7-94f8-69945b82e791.png)
- Locate your `oneagent_installer_script_url`, as shown below.
![Alt text](https://raw.githubusercontent.com/Dynatrace/Dynatrace-OneAgent-Ansible/images/url_script_screenshot.png)
4. For **Windows**
- Rightclick on "Download agent.exe" button and select "Copy link address"
5. Paste the url as a value for the *oneagent_installer_script_url* variable in `defaults/main.yml`.

### Previous versions

If you’ve been using automated scripts or deployment via YAML utilizing the TENANT, SERVER, TENANT_TOKEN command line arguments, you’ll find that the new approach is fully transparent and no changes are required.

## Example Playbook

```
Expand Down Expand Up @@ -60,7 +64,9 @@ bundle install
kitchen test
```

By default, we run our tests inside [Docker](https://www.docker.com/) containers as this considerably speeds up testing time (see `.kitchen.yml`).
By default, we run our tests using [Vagrant](https://www.vagrantup.com/) provisioning tool (see `.kitchen.yml`) since installation OneAgent on [Docker](https://www.docker.com/) containers is possible only by running Docker command -> [see our blog article](https://www.dynatrace.com/blog/new-docker-image-leverages-bootstrapper-download-oneagent-installer/).

*Please note, that running tests using Vagrant provisioning on virtual machine or cloud instance may cause serious difficulties since [VT-x](https://en.wikipedia.org/wiki/X86_virtualization#Intel_virtualization_.28VT-x.29) or [AMD-V](https://en.wikipedia.org/wiki/X86_virtualization#AMD_virtualization_.28AMD-V.29) virtualization can't be nested.*

## License

Expand Down
4 changes: 4 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
---
oneagent_installer_script_url:
# for backward compatibility:
dynatrace_oneagent_cluster_subdomain:
dynatrace_oneagent_environment_id:
dynatrace_oneagent_tenant_token:
45 changes: 37 additions & 8 deletions tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,38 @@
---
- name: "Download Dynatrace OneAgent"
get_url:
url: "{{ oneagent_installer_script_url }}"
dest: "/tmp/dynatrace-oneagent.sh"

- name: "Install Dynatrace OneAgent"
shell: "sh /tmp/dynatrace-oneagent.sh"
become: yes
- name: Download Dynatrace OneAgent using token id
block:
- fail:
msg: "The 'dynatrace_oneagent_cluster_subdomain' variable has not been set, it must point to the subdomain of your Dynatrace cluster. Please consult the documentation."
when: (dynatrace_oneagent_cluster_subdomain is undefined) or (dynatrace_oneagent_cluster_subdomain is none) or (dynatrace_oneagent_cluster_subdomain | trim == "")
- fail:
msg: "The 'dynatrace_oneagent_environment_id' variable has not been set, it must contain the Dynatrace tenant id. Please consult the documentation."
when: (dynatrace_oneagent_environment_id is undefined) or (dynatrace_oneagent_environment_id is none) or (dynatrace_oneagent_environment_id | trim == "")
- fail:
msg: "The 'dynatrace_oneagent_tenant_token' variable has not been set, it must contain the Dynatrace tenant token. Please consult the documentation."
when: (dynatrace_oneagent_tenant_token is undefined) or (dynatrace_oneagent_tenant_token is none) or (dynatrace_oneagent_tenant_token | trim == "")
- name: "[Backward Compatibility Task] Download Dynatrace OneAgent (for Dynatrace SaaS)"
get_url:
url: "https://{{ dynatrace_oneagent_environment_id }}.{{ dynatrace_oneagent_cluster_subdomain }}/installer/oneagent/unix/latest/{{ dynatrace_oneagent_tenant_token }}"
dest: "/tmp/dynatrace-oneagent.sh"
when: ("live.dynatrace.com" == dynatrace_oneagent_cluster_subdomain) or ("live.ruxit.com" == dynatrace_oneagent_cluster_subdomain) or ("sprint.dynatracelabs.com" == dynatrace_oneagent_cluster_subdomain)
- name: "[Backward Compatibility Task] Download Dynatrace OneAgent (for Dynatrace Managed)"
get_url:
url: "https://{{ dynatrace_oneagent_cluster_subdomain }}/e/{{ dynatrace_oneagent_environment_id }}/installer/agent/unix/latest/{{ dynatrace_oneagent_tenant_token }}"
dest: "/tmp/dynatrace-oneagent.sh"
when: ("live.dynatrace.com" != dynatrace_oneagent_cluster_subdomain) and ("live.ruxit.com" != dynatrace_oneagent_cluster_subdomain)
when: (oneagent_installer_script_url is undefined) or (oneagent_installer_script_url is none) or (oneagent_installer_script_url | trim == "")

- name: Download Dynatrace OneAgent using installer script url
block:
- fail:
msg: "The 'oneagent_installer_script_url' variable has not been set, it must contain the Dynatrace OneAgent Installer Script URL. Please consult the documentation."
when: (oneagent_installer_script_url is undefined) or (oneagent_installer_script_url is none) or (oneagent_installer_script_url | trim == "")
- name: "Download Dynatrace OneAgent"
get_url:
url: "{{ oneagent_installer_script_url }}"
dest: "/tmp/dynatrace-oneagent.sh"
when: (oneagent_installer_script_url is defined) and (oneagent_installer_script_url is not none)

- name: "Install Dynatrace OneAgent"
shell: "sh /tmp/dynatrace-oneagent.sh"
become: yes
5 changes: 2 additions & 3 deletions test/integration/default/default.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
---
- hosts: test-kitchen
roles:
- role: Dynatrace.OneAgent
dynatrace_oneagent_environment_id: 123
dynatrace_oneagent_tenant_token: abc
- role: Dynatrace-OneAgent-Ansible
oneagent_installer_script_url:

0 comments on commit 55071f3

Please sign in to comment.