On 21.03.2019 12:58, Suhail Choudhury wrote: > Thanks for your earlier reply Adam. > > So how can I combine variables for a list of "users" defined like so: > > *group_vars/all* > > users: > - name: alice > comment: Alice > > *group_vars/group1* > > users: > - name: bob > comment: Bob > > *host_vars/host1* > > users: > - name: charlie > comment: Charlie > > How can all these variables be combined using "loop" or "with_items"?
You can't, they will be overwritten in the order listed here https://docs.ansible.com/ansible/latest/user_guide/playbooks_variables.html#variable-precedence-where-should-i-put-a-variable > What if there are duplicates? They are duplicates since all are call users and will be overwritten. > Can the "host_vars/host1" variables override and take precedence over the > "group_vars/all" variables? It does. -- Kai Stian Olstad -- 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 [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/86213972-a12c-474a-0284-747eaa825cdd%40olstad.com. For more options, visit https://groups.google.com/d/optout.
