roles - apply variable values from /defaults/main.yml

using roles with this type of structure and face a problem with variable values apparently not being applied from the /defaults/main.yml

role01

__/tasks

__main.yml

__/defaults

__main.yml

As far my understanding goes the /tasks/main.yml should read the variables from /defaults/main.yml no matter what (without any vars_files: declaration. Is that understanding correct?

If not, how exactly do I have to reference the /defaults/main.yml ?

As far my understanding goes the /tasks/main.yml should read the variables from /defaults/main.yml no matter what (without any vars_files: declaration. Is that understanding correct?

Yes. This is correct. For example

tree roles

roles
└── role01
    ├── defaults
    │ └── main.yml
    └── tasks
        └── main.yml

3 directories, 2 files

cat roles/role01/defaults/main.yml

test_var: Hello

cat roles/role01/tasks/main.yml

- debug:
    var: test_var

cat playbook.yml

- hosts: localhost
  roles:
    - role01

ansible-playbook playbook.yml

gives (abridged)

TASK [role01 : debug]

so, that is a clear yes (and great little exercise) then.
I'll have to figure out, why it does't work atm

thx for sharing

so, that is a clear yes (and great little exercise) then.
I'll have to figure out, why it does't work atm

thx for sharing

Well to get help you need to elaborate on "why it does't work atm".

The variables in defaults/main.yml do have very low priority BTW.

Regards

           Racke