On Thu, 20 Jan 2022 17:15:42 +0100 (CET)
dulhaver via Ansible Project <ansible-project@googlegroups.com> wrote:

> 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

shell> tree roles
roles
└── role01
    ├── defaults
    │   └── main.yml
    └── tasks
        └── main.yml

3 directories, 2 files

shell> cat roles/role01/defaults/main.yml 
test_var: Hello

shell> cat roles/role01/tasks/main.yml 
- debug:
    var: test_var

shell> cat playbook.yml
- hosts: localhost
  roles:
    - role01

shell> ansible-playbook playbook.yml

gives (abridged)

TASK [role01 : debug]
**********************************
ok: [localhost] =>
  test_var: Hello


If this is not working for you provide "Minimal nonworking example"
https://en.wikipedia.org/wiki/Minimal_working_example

-- 
Vladimir Botka

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/20220120173923.6b4ce819%40gmail.com.

Attachment: pgpWPihcCm6vm.pgp
Description: OpenPGP digital signature

Reply via email to