December 2018
Intermediate to advanced
226 pages
4h 57m
English
As we now expect the results to be stored in the trace_result variable, we need to ensure each of the output responses is validated for each host.
Using with_items, we iterate over the results of the trace_result variable. As the earlier execution happened over multiple hosts, the output stored in trace_result is in list format. To iterate each item in the variable, we refer trace_result.results instead of only the variable:
# - name: Debug registered variables # debug: var=trace_result - name: Check ping failure fail: msg="Ping not responding {{ item.stdout_lines }}" when: "'100 percent' not in item.stdout[0]" with_items: "{{ trace_result.results }}" #when: "'100 percent' not in "{{ trace_result }}""
The fail and ...
Read now
Unlock full access