Ansible role variables

36 views
Skip to first unread message

Martin Jablečník

unread,
Jul 13, 2017, 1:59:59 PM7/13/17
to Ansible Project

Hello I have Ansible 2.3.0.0 with this roles in playbook:


- { role: bwt-container, tags: ['bwt_en', 'bwt'], vars: { app_lang: "en" } }
- { role: bwt-container, tags: ['bwt_de', 'bwt'], vars: { app_lang: "de" } }
 

BWT application have various languages, which I would like define in vars. But when I run:


ansible-playbook -v site.yml --limit test-server --tags bwt_en 

So app_lang variable have "de" value..
Why??
I would like have 2 containers with various languages..
Do you know anyone how resolve it??




https://superuser.com/questions/1229183/ansible-role-variables

Martin Jablečník

unread,
Jul 13, 2017, 1:59:59 PM7/13/17
to Ansible Project

I have Ansible 2.3.0.0 with this roles in playbook:


- { role: bwt-container, tags: ['bwt_en', 'bwt'], vars: { app_lang: "en" } }
- { role: bwt-container, tags: ['bwt_de', 'bwt'], vars: { app_lang: "de" } }
 

BWT application have various languages, which I would like define in vars. But when I run:


ansible-playbook -v site.yml --limit test-server --tags bwt_en 

So app_lang variable have "de" value..

Why??
I would like have 2 containers with various languages..

Do you anyone know how resolve it??


Kai Stian Olstad

unread,
Jul 14, 2017, 11:01:50 AM7/14/17
to ansible...@googlegroups.com
On 12. juli 2017 17:03, Martin Jablečník wrote:
> Hello I have Ansible 2.3.0.0 with this roles in playbook:
>
>
> - { role: bwt-container, tags: ['bwt_en', 'bwt'], vars: { app_lang: "en" } }
> - { role: bwt-container, tags: ['bwt_de', 'bwt'], vars: { app_lang: "de" } }
>
>
> BWT application have various languages, which I would like define in vars.
> But when I run:
>
>
> ansible-playbook -v site.yml --limit test-server --tags bwt_en
>
> So app_lang variable have "de" value..
> Why??
> I would like have 2 containers with various languages..
> Do you know anyone how resolve it??

You have a bug in your code and since you have not provided the code
it's hard to help.

--
Kai Stian Olstad

Trond Hindenes

unread,
Jul 14, 2017, 7:07:50 PM7/14/17
to Ansible Project, ansible-pr...@olstad.com
I think I've seen this somewhere else as well.

Maybe look into implementing it as a play using multiple include_role tasks instead?
Reply all
Reply to author
Forward
0 new messages