Hi,

I stumbled onto little mind game with ansible today : D .

I have three roles that are tagged.

- hosts: vagrant
>   sudo: yes
>   roles:
>     - {role: ansible_users, tags: users}
>     - {role: ansible_nginx, tags: nginx}
>     - {role: ansible_mysql, tags: mysql}
>

I have defaults/main.yml for "ansible_users" and "ansible_mysql" in their 
respective places.

This is "ansible_users" defaults:

---
> users:
>   - user: detlic
>     webdir:
>       - woodpecker
>       - aligator
>   - user: keder
>     webdir: []
>

This is "ansible_mysql" defaults:

---
> users:
>   - user: detlic
>     db:
>       - aligatordb
>       - woodpeckerdb
>   - user: jazavac
>     db:
>       - badgerdb
>       - ddaybdb
>

I have left NGINX role without "defaults". How I understand things is that 
NGINX will inherit "defaults" vars from other roles and use them where it 
can. But in this case {{ VARS }} are named the same in both USER and MYSQL 
roles.

NGINX role is before MYSQL from whoom it should inherit vars? In my test 
case it inherits it from the LAST role in the list. So in this case it is 
MYSQL. If I remove MYSQL role from a list then everything is fine.

Another thing is if I leave MYSQL role present BUT use TAGS and play roles 
with jsut USERS and NGINX tags, still NGINX inherits "defaults" from MYSQL.

Can someone comment on this.

-- 
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/eb9bf810-d04e-4998-86e4-72e0ab8aa791%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to