From dda82a929572bb0c036bc5c09ebb73d3142e3db7 Mon Sep 17 00:00:00 2001 From: Sorin Sbarnea Date: Fri, 18 Mar 2022 14:08:47 +0000 Subject: [PATCH] Avoid processing files under templates Fixes: #1753 --- examples/templates/playbooks/playbook.yml | 5 +++++ src/ansiblelint/config.py | 1 + 2 files changed, 6 insertions(+) create mode 100644 examples/templates/playbooks/playbook.yml diff --git a/examples/templates/playbooks/playbook.yml b/examples/templates/playbooks/playbook.yml new file mode 100644 index 00000000000..848ce48de2e --- /dev/null +++ b/examples/templates/playbooks/playbook.yml @@ -0,0 +1,5 @@ +# even if is hosted under playbooks and is named playbook.yml, this file +# is not a real playbook because it is hosted in a "templates" directory +# and that means we will avoid processing it as a playbook. Templates use +# either jinja2 or another templating engine, so we cannot load them. +foo: bar diff --git a/src/ansiblelint/config.py b/src/ansiblelint/config.py index 7d8be12adbc..6d6b8c36f00 100644 --- a/src/ansiblelint/config.py +++ b/src/ansiblelint/config.py @@ -9,6 +9,7 @@ # Do not sort this list, order matters. {"jinja2": "**/*.j2"}, # jinja2 templates are not always parsable as something else {"jinja2": "**/*.j2.*"}, + {"text": "**/templates/**/*.*"}, # templates are likely not validable {"inventory": "**/inventory/**.yml"}, {"requirements": "**/meta/requirements.yml"}, # v1 only # https://docs.ansible.com/ansible/latest/dev_guide/collections_galaxy_meta.html