Trying to compare the installed package version and upgrade to latest version in Ansible, Blocked at when package is not installed in server.
- debug:
msg: "Installed version is null or lower than {{ gcc_new_version.stdout }}"
when: 'gcc_version.stdout == "" || gcc_version.stdout is version(gcc_new_version.stdout, '<')
Error:
fatal: FAILED! => {"msg": "The conditional check 'gcc_version.stdout == "" || gcc_version.stdout is version(gcc_new_version.stdout, '<')' failed. The error was: template error while templating string: expected token 'name', got '|'. String: {% if gcc_version.stdout == "" || gcc_version.stdout is version(gcc_new_version.stdout, '<') %} True {% else %} False {% endif %}\n\nThe error appears to be in 'ansible/roles/linux/tasks/gcc.yml': line 24, 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- debug:\n ^ here\n"}