On 20/01/2022 19:47, dulhaver via Ansible Project wrote:
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




On 01/20/2022 5:39 PM Vladimir Botka <vbo...@gmail.com> wrote:

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.


--
Ecommerce and Linux consulting + Perl and web application programming.
Debian and Sympa administration.

--
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/d469fdfb-dafb-e632-03a0-05bafb0b1340%40linuxia.de.

Attachment: OpenPGP_signature
Description: OpenPGP digital signature

Reply via email to