Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Breaks when in check mode #610

Open
tophitter opened this issue Sep 10, 2024 · 0 comments · May be fixed by #619
Open

Breaks when in check mode #610

tophitter opened this issue Sep 10, 2024 · 0 comments · May be fixed by #619

Comments

@tophitter
Copy link

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"]

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`

@tophitter tophitter changed the title Break when in check mode Breaks when in check mode Sep 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant