DataDog / ansible-datadog

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

Error in latest version of role related to APM Injection library #606

Open ecout opened 2 weeks ago

ecout commented 2 weeks ago

Ansible Role version: 4.27.0 Operating systems: RHEL 7, 8 and 9. Role inputs: See attached at the bottom. Job outputs: See attached. We include all combinations of fail and success. job_3614_RHEL7-reinstall-fails.txt job_3622_RHEL7_and_RHEL9_fresh-install_success_with-RHEL8-reinstall-failing.txt job_3624_RHEL7-host-rerun-role-fails.txt job_3626_RHEL_9-fails_with-debug-mode.txt job_3626_RHEL_9-succeeds-new-fresh-install-job-rerun_with-debug-mode.txt

Error: After running the playbook a couple of iterations to configure integrations and the datadog.yaml file on the same server we got the following error:

TASK [ansible-datadog-4.27.0 : Install APM inject library (dnf)] *************** fatal: [inf-lnx-003-ld.domestic.guitarcenter.com]: 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 '/runner/project/roles/ansible-datadog-4.27.0/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"}

The variable datadog_installer_owns_injector is actually set in another file, here: installer-setup.yml on this task:

- name: Check if installer owns apm injector package command: datadog-installer is-installed "{{ datadog_inject_apm_flavor }}" failed_when: datadog_installer_owns_injector.rc != 0 and datadog_installer_owns_injector.rc != 10 register: datadog_installer_owns_injector when: not datadog_installer_bootstrap_result.failed changed_when: true

Which we can attest did NOT get executed on that host(RHEL8) but DOES get executed in two other different hosts (RHEL 7 and RHEL9) when the same role was used to perform a fresh install of datadog.

With that said, we did a second run of the role on the RHEL7 host and got the same error as above. So there must be something in the input variables that is triggering this. Here are the relevant settings being passed as var files that might be triggering this scenario. Again, the version of this role is 4.27.0

configure_datadog_installer.txt datadog_agent_config.txt datadog_integrations_jboss.txt

Update: We've discovered that version 4.20 doesn't have that variable therefore it doesn't present that bug. datadog_installer_owns_injector

bartier commented 1 week ago

Just a heads up for the maintainers that I could reproduce the issue as well.