You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When you run the new version with --check it failing due to conditional check as it can not find datadog_installer_install_result.failed
This is due to the include tasks to install for either DNF , YUM, DEB, and zypper get skipped when in check mode so the var datadog_installer_install_result.failed is not defined
tasks/installer-setup.yml ln 15 to 29
has this code
`- name: Include installer DNF install task
ansible.builtin.include_tasks: pkg-redhat/install-installer-dnf.yml
when: ansible_facts.os_family in ["RedHat", "Rocky", "AlmaLinux"] and not ansible_check_mode and ansible_pkg_mgr == "dnf"
name: Include installer YUM install task
ansible.builtin.include_tasks: pkg-redhat/install-installer-yum.yml
when: ansible_facts.os_family in ["RedHat", "Rocky", "AlmaLinux"] and not ansible_check_mode and ansible_pkg_mgr == "yum"
name: Include installer DEB install task
ansible.builtin.include_tasks: pkg-debian/install-installer.yml
when: ansible_facts.os_family == "Debian" and not ansible_check_mode
name: Include installer Zypper install task
ansible.builtin.include_tasks: pkg-suse/install-installer-zypper.yml
when: ansible_facts.os_family == "Suse" and not ansible_check_mode`
from what i can tell so far we could just remove the and not ansible_check_mode check from those lines and this will allow the check mode to run without error or we could use the not datadog_installer_install_result.failed | default(false) on the conditional check to stop it throwing a failed action maybe
also this only seem to fail on check mode when enable apm datadog_apm_instrumentation_enabled: "host" datadog_apm_instrumentation_libraries: ["all"]
TASK [datadog.dd.agent : Bootstrap the installer] *********************************************************************************************************************************************************
fatal: [127.0.0.1]: FAILED! => {"msg": "The conditional check 'not datadog_installer_install_result.failed' failed. The error was: error while evaluating conditional (not datadog_installer_install_result.failed): 'datadog_installer_install_result' is undefined. 'datadog_installer_install_result' is undefined\n\nThe error appears to be in '/home/****/.ansible/collections/ansible_collections/datadog/dd/roles/agent/tasks/installer-setup.yml': line 31, 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: Bootstrap the installer\n ^ here\n"}
...ignoring`
The text was updated successfully, but these errors were encountered:
tophitter
changed the title
Break when in check mode
Breaks when in check mode
Sep 10, 2024
When you run the new version with --check it failing due to conditional check as it can not find
datadog_installer_install_result.failed
This is due to the include tasks to install for either
DNF
,YUM
,DEB
, andzypper
get skipped when in check mode so the vardatadog_installer_install_result.failed
is not definedtasks/installer-setup.yml ln 15 to 29
has this code
`- name: Include installer DNF install task
ansible.builtin.include_tasks: pkg-redhat/install-installer-dnf.yml
when: ansible_facts.os_family in ["RedHat", "Rocky", "AlmaLinux"] and not ansible_check_mode and ansible_pkg_mgr == "dnf"
name: Include installer YUM install task
ansible.builtin.include_tasks: pkg-redhat/install-installer-yum.yml
when: ansible_facts.os_family in ["RedHat", "Rocky", "AlmaLinux"] and not ansible_check_mode and ansible_pkg_mgr == "yum"
name: Include installer DEB install task
ansible.builtin.include_tasks: pkg-debian/install-installer.yml
when: ansible_facts.os_family == "Debian" and not ansible_check_mode
name: Include installer Zypper install task
ansible.builtin.include_tasks: pkg-suse/install-installer-zypper.yml
when: ansible_facts.os_family == "Suse" and not ansible_check_mode`
from what i can tell so far we could just remove the
and not ansible_check_mode
check from those lines and this will allow the check mode to run without error or we could use thenot datadog_installer_install_result.failed | default(false)
on the conditional check to stop it throwing a failed action maybealso this only seem to fail on check mode when enable apm
datadog_apm_instrumentation_enabled: "host" datadog_apm_instrumentation_libraries: ["all"]
the test playbook i used to get this error
- hosts: localhost gather_facts: true tasks: - name: Import Datadog Agent role import_role: name: datadog.dd.agent vars: datadog_api_key: "********" datadog_site: "datadoghq.eu" datadog_agent_major_version: 7 datadog_apm_instrumentation_enabled: "host" datadog_apm_instrumentation_libraries: ["all"]
if we run this with no --check flag then it will work fine.
Command :
ansible-playbook datadog.yml --diff --check
Output:
`TASK [datadog.dd.agent : Include installer DNF install task] **********************************************************************************************************************************************
skipping: [127.0.0.1]
TASK [datadog.dd.agent : Include installer YUM install task] **********************************************************************************************************************************************
skipping: [127.0.0.1]
TASK [datadog.dd.agent : Include installer DEB install task] **********************************************************************************************************************************************
skipping: [127.0.0.1]
TASK [datadog.dd.agent : Include installer Zypper install task] *******************************************************************************************************************************************
skipping: [127.0.0.1]
TASK [datadog.dd.agent : Bootstrap the installer] *********************************************************************************************************************************************************
fatal: [127.0.0.1]: FAILED! => {"msg": "The conditional check 'not datadog_installer_install_result.failed' failed. The error was: error while evaluating conditional (not datadog_installer_install_result.failed): 'datadog_installer_install_result' is undefined. 'datadog_installer_install_result' is undefined\n\nThe error appears to be in '/home/****/.ansible/collections/ansible_collections/datadog/dd/roles/agent/tasks/installer-setup.yml': line 31, 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: Bootstrap the installer\n ^ here\n"}
...ignoring`
The text was updated successfully, but these errors were encountered: