DataDog/ansible-datadog

Error in latest version of role related to APM Injection library

Closed this issue · 2 comments

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

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

Hello and thanks for the report!
I believe this is the same issue as described in #603

It should be fixed in the version 4.28 of the role that was just released :)

Please reopen the issue if this isn't the case