Re: [ansible-project] ternary clarification needed

2020-03-26 Thread Davide Scrimieri
Thank you all for the answers. I used the solution "from_yaml" provided by Vladimir and it works like a charm, and it's also cleaner. However, if this is the case, I don't believe this is an issue of how ternary works, but of how "from_json" works. My gut feeling is that it shouldn't behave that

Re: [ansible-project] ternary clarification needed

2020-03-26 Thread Martin Krizek
On Thu, Mar 26, 2020 at 7:55 AM Davide Scrimieri wrote: > > Hello, > > Whenever a ternary is used are both conditions evaluated regardless ? > > For example, I want to convert "my_other_var" to an object only if it is > passed as as string, otherwise I don't want to touch the object, and leave

Re: [ansible-project] ternary clarification needed

2020-03-26 Thread Vladimir Botka
On Wed, 25 Mar 2020 23:54:57 -0700 (PDT) Davide Scrimieri wrote: > I want to convert "my_other_var" to an object only if it is > passed as as string, otherwise I don't want to touch the object, and leave > it as it is. > > - set_fact: > my_var: "{{ ( my_other_var | type_debug == 'str' )