ansible-lint icon indicating copy to clipboard operation
ansible-lint copied to clipboard

ignore_unreachable doesnt work with jinja templates

Open RayJin2000 opened this issue 10 months ago • 0 comments

Summary

When I use a Jinja Template in ignore_unreachable I get the following error:

WARNING  Listing 1 violation(s) that are fatal
schema[playbook]: $[0].tasks[0].ignore_unreachable "{{ 'yes' | bool }}" is not of type 'boolean'
playbooks/test.yml:1  Returned errors will not include exact line numbers, but they will mention
the schema name being used as a tag, like ``schema[playbook]``,
``schema[tasks]``.

This rule is not skippable and stops further processing of the file.

If incorrect schema was picked, you might want to either:

* move the file to standard location, so its file is detected correctly.
* use ``kinds:`` option in linter config to help it pick correct file type.
Issue Type
  • Bug Report
OS / ENVIRONMENT
ansible-lint --version
ansible-lint 24.2.1 using ansible-core:2.16.4 ansible-compat:4.1.11 ruamel-yaml:0.18.6 ruamel-yaml-clib:0.2.7
STEPS TO REPRODUCE
---
- name: Test
  hosts: localhost
  tasks:
    - name: Debug
      ansible.builtin.debug:
        msg: Bla
      ignore_unreachable: "{{ 'yes' | bool }}"

Desired Behavior
> ansible-lint -c .ansible-lint playbooks/test.yml 

Passed: 0 failure(s), 0 warning(s) on 1 files. Last profile that met the validation criteria was 'production'.
Actual Behavior
> ansible-lint -c .ansible-lint playbooks/test.ym

ARNING  Listing 1 violation(s) that are fatal
schema[playbook]: $[0].tasks[0].ignore_unreachable "{{ 'yes' | bool }}" is not of type 'boolean'
playbooks/test.yml:1  Returned errors will not include exact line numbers, but they will mention
the schema name being used as a tag, like ``schema[playbook]``,
``schema[tasks]``.

This rule is not skippable and stops further processing of the file.

If incorrect schema was picked, you might want to either:

* move the file to standard location, so its file is detected correctly.
* use ``kinds:`` option in linter config to help it pick correct file type.


Read documentation for instructions on how to ignore specific rule violations.

               Rule Violation Summary                
 count tag              profile rule associated tags 
     1 schema[playbook] basic   core                 

Failed: 1 failure(s), 0 warning(s) on 1 files. Last profile that met the validation criteria was 'min'.

RayJin2000 avatar Apr 02 '24 07:04 RayJin2000