diff --git a/examples/group_vars/all.yml b/examples/group_vars/all.yml new file mode 100644 index 00000000000..ce92e88a19a --- /dev/null +++ b/examples/group_vars/all.yml @@ -0,0 +1 @@ +some_var: some_value_defined_in_group_vars_all diff --git a/examples/host_vars/localhost.yml b/examples/host_vars/localhost.yml new file mode 100644 index 00000000000..f3b0d3fc939 --- /dev/null +++ b/examples/host_vars/localhost.yml @@ -0,0 +1 @@ +some_var: some_value_defined_in_host_vars_localhost diff --git a/examples/playbooks/vars/subfolder/settings.yml b/examples/playbooks/vars/subfolder/settings.yml new file mode 100644 index 00000000000..8de2e84449e --- /dev/null +++ b/examples/playbooks/vars/subfolder/settings.yml @@ -0,0 +1 @@ +some_var: some_value_defined_in_vars_subfolder_settings diff --git a/src/ansiblelint/config.py b/src/ansiblelint/config.py index 8a977587514..97cd543f8db 100644 --- a/src/ansiblelint/config.py +++ b/src/ansiblelint/config.py @@ -20,7 +20,7 @@ {"role": "**/roles/*/"}, {"tasks": "**/tasks/*.{yaml,yml}"}, {"handlers": "**/handlers/*.{yaml,yml}"}, - {"vars": "**/{vars,defaults}/*.{yaml,yml}"}, + {"vars": "**/{host_vars,group_vars,vars,defaults}/**/*.{yaml,yml}"}, {"meta": "**/meta/main.{yaml,yml}"}, {"yaml": ".config/molecule/config.{yaml,yml}"}, # molecule global config {"yaml": "**/molecule/*/molecule.{yaml,yml}"}, # molecule config diff --git a/test/TestUtils.py b/test/TestUtils.py index bf4102a6773..7b4307a1d93 100644 --- a/test/TestUtils.py +++ b/test/TestUtils.py @@ -349,6 +349,9 @@ def test_is_playbook(): # Undeterminable files: ("test/fixtures/unknown-type.yml", "yaml"), ("releasenotes/notes/run-playbooks-refactor.yaml", "reno"), # reno + ("examples/host_vars/localhost.yml", "vars"), + ("examples/group_vars/all.yml", "vars"), + ("examples/playbooks/vars/subfolder/settings.yml", "vars"), # deep vars ), ) def test_auto_detect(monkeypatch, path: str, kind: FileType) -> None: