Dump Hole
2015-07-23 19:18:12 UTC
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.
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 ansible-project+***@googlegroups.com.
To post to this group, send email to ansible-***@googlegroups.com.
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.
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 ansible-project+***@googlegroups.com.
To post to this group, send email to ansible-***@googlegroups.com.
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.