DataDog / ansible-datadog

Ansible role for Datadog Agent
Apache License 2.0
298 stars 222 forks source link

APM Installation error #603

Closed yashpalk closed 1 month ago

yashpalk commented 2 months ago

Hey there, I'm trying to install APM via this ansible role and am seeing the following error. Is there something that I need to update with my configuration or is this an internal role error?

Running Ansible [core 2.15.12] on a rhel8 host and setting the following variables:

    datadog_apm_instrumentation_enabled: host
    datadog_apm_instrumentation_libraries: [ "java" ]

Error:

TASK [datadog.dd.agent : Install APM inject library (dnf)] ***********************************************************************************************************************************************************************************
fatal: [<redacted>]: FAILED! => {"msg": "The conditional check 'not ansible_check_mode and ansible_pkg_mgr == \"dnf\" and (not datadog_installer_enabled or not datadog_installer_owns_injector)' failed. The error was: error while evaluating conditional (not ansible_check_mode and ansible_pkg_mgr == \"dnf\" and (not datadog_installer_enabled or not datadog_installer_owns_injector)): 'datadog_installer_owns_injector' is undefined. 'datadog_installer_owns_injector' is undefined\n\nThe error appears to be in '<redacted>/collections/ansible_collections/datadog/dd/roles/agent/tasks/pkg-redhat/install-apm-inject.yml': line 10, column 3, 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 APM inject library (dnf)\n  ^ here\n"}
chouquette commented 2 months ago

Hi, This is most likely an internal error, but I haven't been able to reproduce it. Could you provide more insight on your config and ideally the full logs?

yashpalk commented 2 months ago

Thanks, attaching the full logs for the agent role. Let me know if there are specific things you'd like to get insight on regarding our config, I think we use the defaults from the role other than the two ones listed above

datadog agent logs.txt

chouquette commented 1 month ago

Hello, and sorry for the delay. AFAICS it boils down to this task:

- name: RedHat Install Tasks                                                                          
  include_tasks: pkg-redhat.yml                                                                       
  when: ansible_facts.os_family in ["RedHat", "Rocky", "AlmaLinux"] and not agent_datadog_skip_install

being skipped while it shouldn't. This leads to a bunch of facts not being set. I'll dig further into it

chouquette commented 1 month ago

Alright, I managed to reproduce this in a test. The culprit seems to be that a specific agent version is pinned in your config, which causes some shortcuts to kick in and they don't mix well with some of the newly added features.

I'll provide a fix soon and will link it to here. Thanks a lot for opening the issue and providing the logs!

yashpalk commented 1 month ago

Sounds good, thanks for your help!

yashpalk commented 1 month ago

Hey! Wanted to check when you plan to release the next version that will contain this change

chouquette commented 1 month ago

Hello :wave:

We do plan on releasing a new version of the role early next week