Skip to content

Misleading statement about "defaults" and "vars" sub-folders of roles #2994

@mikhailknyazev

Description

@mikhailknyazev

Summary

Hi all, there is misleading statement in https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_reuse_roles.html :
"
Directories defaults and vars may also include nested directories. If your variables file is a directory, Ansible reads all variables files and directories inside in alphabetical order.
"
It is misleading because that holds true ONLY for "defaults/main/" and "vars/main/" subdirectories.

Please find the detailed description and the test project attached.

Issue Type

Documentation Report

Component Name

https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_reuse_roles.html

Ansible Version

$ ansible --version
ansible [core 2.14.9]
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/ec2-user/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.9/site-packages/ansible
  ansible collection location = /home/ec2-user/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.9.18 (main, Jan  4 2024, 00:00:00) [GCC 11.4.1 20230605 (Red Hat 11.4.1-2)] (/usr/bin/python3)
  jinja version = 3.1.2
  libyaml = True

Configuration

# if using a version older than ansible-core 2.12 you should omit the '-t all'
$ ansible-config dump --only-changed -t all
CONFIG_FILE() = /etc/ansible/ansible.cfg

OS / Environment

cat /etc/os-release

NAME="Red Hat Enterprise Linux"
VERSION="9.3 (Plow)"

Additional Information

playbook_and_role_variables_test_MK_18Aug2025.pdf

playbook_variables_test.zip

Code of Conduct

  • I agree to follow the Ansible Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueGood for newcomersnew_contributorThis PR is the first contribution by a new community member.

    Type

    No type

    Projects

    Status

    🆕 Triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions