[ansible-project] Re: Create a varaible list conditionally from dictionary items

2015-05-20 Thread Javeria Khan
Right thanks guys. And what about using a condition that checks if my_dict contains a entry with name == name2 ? Its not a loop, just a conditional for file include so I need a one liner. -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To

Re: [ansible-project] Re: Create a varaible list conditionally from dictionary items

2015-05-20 Thread Shawn Ferry
On Wed, May 20, 2015 at 3:19 PM Javeria Khan wrote: > > Also, another quick question. If I was using my_dict in a task loop, could > i put a condition on: > > Right that is my example. Here it is in code when item_en is false the item is skipped. TASK: [Loop]

[ansible-project] Re: Create a varaible list conditionally from dictionary items

2015-05-20 Thread Christian Thiemann
Yes, I have that stuff in my group_vars/all and in various vars.yml files. There no special magic to it except that you have to enable the do extension in ansible.cfg. Every string variable in Ansible is fed through the templating engine: --- foobar_config_path: "/etc/foobar" foobar_foomatic_

[ansible-project] Re: Create a varaible list conditionally from dictionary items

2015-05-20 Thread Javeria Khan
Also, another quick question. If I was using my_dict in a task loop, could i put a condition on: with_items: my_dict when: item.key is defined will that work? -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this gr

[ansible-project] Re: Create a varaible list conditionally from dictionary items

2015-05-20 Thread Javeria Khan
Thanks guys, Christian is your solution doable in a regular yml? I thought jinja constructs were only allowed in jinja templates? What I have is a regular .yml that defines all my variables. Shawn I believe your solution requires creating a task to loop over my_dict, I prefer to do it outside

[ansible-project] Re: Create a varaible list conditionally from dictionary items

2015-05-20 Thread Shawn Ferry
Why not something like this? do_something_with: item.name with_items: your_dict when: item.item_en == True On Wednesday, May 20, 2015 at 8:41:00 AM UTC-4, Javeria Khan wrote: > > Hi, > > I've tried searching everything but can't find a possible solution. I have > a yml that defines all my varia