Code Monkey home page Code Monkey logo

dynatrace-oneagent-ansible's Introduction

Dynatrace OneAgent collection

In its current state, collection consist of a single role that deploys Dynatrace OneAgent on Linux and Windows operating systems using dedicated configuration and ensures the OneAgent service maintains a running state.

Requirements

Using this collection requires the following:

  • Ansible >= 2.9.0
  • pywinrm >= 0.4.1

Installation

Use ansible-galaxy collection install dynatrace.oneagent to install the latest stable release of the collection on your system.

License

Licensed under the MIT License.

Support

In case of difficulties, contact our SUPPORT.

dynatrace-oneagent-ansible's People

Contributors

beeme1mr avatar blazejt avatar centic9 avatar coryasilva avatar dynapozieblo avatar jkulesz avatar jnoss avatar kristofre avatar luisr-escobar avatar marcinzejer avatar metmajer avatar mkrasu avatar piotrmejer avatar wstechura avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dynatrace-oneagent-ansible's Issues

Create switch to uninstall the agent

Right now this role can only manage the agent to do an installation. It would be great to default to installation, but also function as an uninstaller.

Create an variable option for no_log

Is your feature request related to a problem? Please describe.
currently it's impossible to see any failure in tasks that have no_log: true set without changing the role tasks in the collection. This is annoying to say the least when debugging issues and all we can see is no_log: true messages.

For example, you cannot see what issue is present during the "Install OneAgent" task if it fails.

Describe the solution you'd like
I'd like to be able to pass a variable to switch all the no_logs to false

win_service module is failng due to "enabled: true" in main.ymll

Works fine after removing enabled: true

- name: ensure oneagent has selected state and enabled on boot | windows
  win_service:
    name: "{{ dynatrace_oneagent_service_name }}"
    state: "{{ dynatrace_oneagent_state }}"
    enabled: true
  when: dynatrace_oneagent_package_state != "absent" and ansible_system|lower == "win32nt"

Did anyone face this issue on windows agent install?

Validate certs do not work with the last release

I was trying to install the oneagent with the parameter validate_certs=false. I installed the role from ansible galaxy however it did not work. Upon troubleshooting found that the Variable was not present in the role.
There is a commit on this Repo which has fixed it 13 months ago but it is not updated in Ansible Galaxy. Please create a new release in Ansible Galaxy.

Download fails with unsupported or outdated web browser

Problem

source https://github.com/Dynatrace/Dynatrace-OneAgent-Ansible/blob/master/tasks/download.yml#L24-L36

The ansible module get_url and win_get_url default http agent is ansible-httpget and can be configured with the http_agent parameter
https://docs.ansible.com/ansible/latest/collections/ansible/builtin/get_url_module.html#parameter-http_agent
https://docs.ansible.com/ansible/latest/collections/ansible/windows/win_get_url_module.html#parameter-http_agent

The Dynatrace endpoint /api/v1/deployment/installer/agent/unix/default/latest returns this and the ansible task which installs the agent fails.

$ tail -n 19 /tmp/Dynatrace-OneAgent-Linux-latest.sh
                <div class="container">
                        <div>
                                <div class="errorHeader">
                                        <div>This isn't a good fit</div>
                                </div>
                        </div>
                        <div class="detailsPanel">
                                You're using an unsupported or outdated web browser.<br />
                        </div>
                        <div class="links">
                                <a class="link"
                                   href="https://dt-url.net/op81plo?dt=s">
                                        List of supported browsers
                                </a>
                        </div>
                </div>
                <div class="illustration" name="client-server"><div class="inner"></div></div>
        </body>
</html>
TASK [dynatrace.oneagent : install dynatrace oneagent | linux] *********************************************************************************************************************************************************************************************************************

fatal: [xxxx]: FAILED! => {"changed": true, "cmd": ["sh", "/tmp/Dynatrace-OneAgent-Linux-latest.sh", "APP_LOG_CONTENT_ACCESS=1", "INFRA_ONLY=0"], "delta": "0:00:00.009544", "end": "2021-03-18 13:02:04.209622", "msg": "non-zero return code", "rc": 2, "start": "2021-03-18 13:02:04.200078", "stderr": "/tmp/Dynatrace-OneAgent-Linux-latest.sh: 12: Syntax error: newline unexpected", "stderr_lines": ["/tmp/Dynatrace-OneAgent-Linux-latest.sh: 12: Syntax error: newline unexpected"], "stdout": "", "stdout_lines": []}

Possible solution 1

Set the http agent to an accepted browser

- name: download dynatrace oneagent | linux
  get_url:
    url: "{{ dynatrace_oneagent_installer_url }}"
    dest: "{{ dynatrace_oneagent_install_script }}"
    http_agent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.82 Safari/537.36"
  when: ansible_system|lower == "linux" and not dynatrace_oneagent_state_file_linux.stat.exists

- name: download dynatrace OneAgent | windows
  win_get_url:
    url: "{{ dynatrace_oneagent_installer_url }}"
    dest: "{{ dynatrace_oneagent_install_script }}"
    http_agent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.82 Safari/537.36"
  when: ansible_system|lower == "win32nt" and not dynatrace_oneagent_state_file_windows.stat.exists

Possible solution 2

The Dynatrace endpoint /api/v1/deployment/installer/agent/unix/default/latest should support the browser user agentansible-httpget.

Improments

The Dynatrace endpoint /api/v1/deployment/installer/agent/unix/default/latest could use HTTP error codes instead of messages in html.

Playbook installs wrong arch

Here's my playbook

- hosts: swarm-prod
  remote_user: root
  gather_facts: False

  vars_files:
    - ./vars/prod.yml

  pre_tasks:
    - name: Bootstrap host with python 2.7
      raw: apt-get install -y python2.7 python-simplejson

  roles:
    - role: Dynatrace.OneAgent
      oneagent_installer_script_url: https://yni11271.live.dynatrace.com/api/v1/deployment/installer/agent/unix/default/latest?Api-Token={{ dynatrace_token }}&arch=x86&flavor=default

Here's outcome:

fatal: [206.189.xxx.xxx]: FAILED! => {"msg": "The conditional check 'ansible_architecture != \"armv7l\" and agent_installed.stat.exists == False' failed. The error was: error while evaluating conditional (ansible_architecture != \"armv7l\" and agent_installed.stat.exists == False): 'ansible_architecture' is undefined\n\nThe error appears to have been in '/home/holms/.ansible/roles/Dynatrace.OneAgent/tasks/main.yml': line 41, column 4, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n - name: \"Install Dynatrace OneAgent\"\n   ^ here\n"}

Ansible version:

holms@debian ~/D/c/l/a/prod> ansible --version
ansible 2.5.4
  config file = None
  configured module search path = [u'/home/holms/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python2.7/dist-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 2.7.13 (default, Nov 24 2017, 17:33:09) [GCC 6.3.0 20170516]

How did we end up with selecting arm ach? :) As you can see it's specified in URL as x86

Error 300: Multiple Choices while downloading 1.0.9 tar.gz

We were able to download One Agent 1.0.9 using the URL https://github.com/Dynatrace/Dynatrace-OneAgent-Ansible/archive/v1.0.9.tar.gz
But this is not working anymore.
The error seen is
the given path has multiple possibilities: #<Git::Ref:0x00007fb802b2c958>, #<Git::Ref:0x00007fb802b2c390>

We have been using ansible role to download this, can this be fixed please? Thanks.
�[0;32m amazon-ebs: - downloading role 'OneAgent', owned by Dynatrace�[0m �[0;32m amazon-ebs: - downloading role from [https://github.com/Dynatrace/Dynatrace-OneAgent-Ansible/archive/v1.0.9.tar.gz�[0m](https://github.com/Dynatrace/Dynatrace-OneAgent-Ansible/archive/v1.0.9.tar.gz%1B[0m) �[1;31m==> amazon-ebs: [ERROR]: failed to download the file: HTTP Error 300: Multiple Choices�[0m �[1;31m==> amazon-ebs: [WARNING]: - Dynatrace.OneAgent was NOT installed successfully.�[0m

The same thing works with 1.0.8.
https://github.com/Dynatrace/Dynatrace-OneAgent-Ansible/archive/v1.0.8.tar.gz

Installation of OneAgent is not idempotent

The playbook downloads and installs the agent even if it already exists.

In general playbooks should be idempotent and not repeat actions that have already been done before.

Make a release

Hello,

Could you please make it a release ?
I'd like to get the changes during Ansible Galaxy upgrade.

Wrong Documentation

The documentation advise to copy/paste the link from the deploy dynatrace but this one does not include the token inside.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.