From 4b7518e615bb87fddb93fee25a392bbc1214114b 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 --- .config/dictionary.txt | 1 + examples/templates/playbooks/playbook.yml | 6 ++++++ src/ansiblelint/config.py | 1 + 3 files changed, 8 insertions(+) create mode 100644 examples/templates/playbooks/playbook.yml diff --git a/.config/dictionary.txt b/.config/dictionary.txt index fa2a4b26c8..488b72f7dc 100644 --- a/.config/dictionary.txt +++ b/.config/dictionary.txt @@ -161,6 +161,7 @@ synchronize sysvinit taskimports taskincludes +templating testmon testns testpath diff --git a/examples/templates/playbooks/playbook.yml b/examples/templates/playbooks/playbook.yml new file mode 100644 index 0000000000..bf852459ac --- /dev/null +++ b/examples/templates/playbooks/playbook.yml @@ -0,0 +1,6 @@ +--- +# 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 7d8be12adb..6d6b8c36f0 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