i think you want: result.stdout|length > 0 On Thu, Jul 23, 2015 at 3:18 PM, Dump Hole <[email protected]> wrote: > I have two shell tasks. The first one runs a check and returns a list of > ids to be removed. The second one will remove these ids. > > The stdout of the first task looks like this: > 1 > 2 > 3 > 4 > > which then gets fed into the second task to remove 1, 2, 3, 4 > > But if the first one cannot find ids to be removed, it will instead return > an empty string rather than an error. How do I check in Ansible for an > empty string, and how do I pass I set the variable through register > > - name: task1 > shell: script1 > register: result > - name: task2 > shell: script2 `script1` > when: result.length() > 0 <<< ?? > > I tried with stdout_lines.length(), length, size(), size, len(). No luck. > > -- > 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 [email protected]. > To post to this group, send email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/ansible-project/c23f50bf-a7f4-4217-a126-ab17d78178d7%40googlegroups.com. > For more options, visit https://groups.google.com/d/optout.
-- Brian Coca -- 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 [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAJ5XC8nzL7hiK_K7Jf0WcE3SLcNWBd2dS%3Dy-v8AOY3-VuikbSg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
