[ansible-project] Re: Testing for a defined but non empty string

2017-01-26 Thread Jinesh Choksi
On Thursday, 26 January 2017 07:50:39 UTC, Michael Shi wrote: > > Is there really no better way to do it? While Leo's method works it's > extremely ugly to look at nor easily reusable. > Would this help you? - name: do something shell: do task when: ansible_local[foo] is defined Instead

Re: [ansible-project] Re: Testing for a defined but non empty string

2017-01-26 Thread Johannes Kastl
On 26.01.17 08:50 Michael Shi wrote: > On Friday, 31 January 2014 22:58:17 UTC+11, Stephen Ryan wrote: >> This works perfectly for most situations however we have a number >> of places where we need to unset the variable to stop the command >> on certain hosts. Neither of the following work when

[ansible-project] Re: Testing for a defined but non empty string

2017-01-25 Thread Michael Shi
Is there really no better way to do it? While Leo's method works it's extremely ugly to look at nor easily reusable. On Friday, 31 January 2014 22:58:17 UTC+11, Stephen Ryan wrote: > > > > Best to explain with an example > > We have tasks setup like > > - name: do something > shell: do task >

[ansible-project] Re: Testing for a defined but non empty string

2016-06-03 Thread einarc
Tell me about it Leo, the documentation on this language is seriously lacking. On Tuesday, April 7, 2015 at 12:54:01 AM UTC-7, Jialiang Liang wrote: > > I faced the same problem. > > I tried Nick Groenen's code and it doesn't work when the params is like > this: > ``` > foo: > ``` > in this

[ansible-project] Re: Testing for a defined but non empty string

2015-12-27 Thread Arbab Nazar
@ Leo Thanks, this work for me as well On Tuesday, April 7, 2015 at 12:54:01 PM UTC+5, Jialiang Liang wrote: > > I faced the same problem. > > I tried Nick Groenen's code and it doesn't work when the params is like > this: > ``` > foo: > ``` > in this case, foo is define and foo == none > >

[ansible-project] Re: Testing for a defined but non empty string

2015-04-07 Thread Jialiang Liang
I faced the same problem. I tried Nick Groenen's code and it doesn't work when the params is like this: ``` foo: ``` in this case, foo is define and foo == none And it doesn't work when foo: ' ' This is what I came up with: not((foo is undefined) or (foo is none) or (foo|trim == '')) Not