Re: [ansible-project] Problem with Conditional variable

2020-01-27 Thread Yehuda Pinhas
Hi guys! Solved. Solution: qos_policy: "{{ 'qos-nested-50m' if bandwidth_mb == 50 else 'qos-nested-new-' ~ bandwidth_mb ~ 'm' }}" Thanks for all replys. Peace out. -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this

Re: [ansible-project] Problem with Conditional variable

2020-01-25 Thread Yehuda Pinhas
Hi! Both solutions given are not working for some reason.. Any other suggestions? -- 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

Re: [ansible-project] Problem with Conditional variable

2020-01-23 Thread Vladimir Botka
> > There are two options for that string: > > 1. qos-nested-50 will be set when bandwidth_mb is 50. > > 2. qos-nested-new-20. 20 for example will set the string to qos-nested-new- > > when bandwidth_mb is not 50. It's possible to use the 'ternary' filter. For example - set_fact:

Re: [ansible-project] Problem with Conditional variable

2020-01-23 Thread Vladimir Botka
On Thu, 23 Jan 2020 06:22:37 -0800 (PST) Yehuda Pinhas wrote: > qos_policy: "{{ 'qos-nested-' + bandwidth_mb }}" > [...] > ** > > ERROR! Syntax Error while loading YAML. did not find

Re: [ansible-project] Problem with Conditional variable

2020-01-23 Thread Stefan Hornburg (Racke)
On 1/23/20 3:22 PM, Yehuda Pinhas wrote: > *Hi!* > *I want to make the variable qos_policy set on conditional basis:* > * > * > *If bandwidth_mb == '50'* > *  then qos_policy == 'qos-nested-50'* > * > * > *else* > *  qos_policy == 'qos-nested-new-50'* > * > * > * > * > *My code is this (not

[ansible-project] Problem with Conditional variable

2020-01-23 Thread Yehuda Pinhas
*Hi!* *I want to make the variable qos_policy set on conditional basis:* *If bandwidth_mb == '50'* * then qos_policy == 'qos-nested-50'* *else* * qos_policy == 'qos-nested-new-50'* *My code is this (not working):* qos_policy: "{{ 'qos-nested-new-' + bandwidth_mb }}" qos_policy: "{{