2012-09-17 20:57:33 +00:00
|
|
|
---
|
|
|
|
# Test iterating over lines of stdout stored in a register.
|
|
|
|
- hosts: localhost
|
2012-11-19 15:30:30 +00:00
|
|
|
connection: local
|
2012-09-17 20:57:33 +00:00
|
|
|
vars:
|
|
|
|
small_file: /etc/resolv.conf
|
|
|
|
temp_file: /tmp/ansible_result_list.tmp
|
|
|
|
|
|
|
|
tasks:
|
|
|
|
- action: command cat $small_file
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- action: file dest=$temp_file state=absent
|
|
|
|
|
|
|
|
- action: shell echo '$item' >> $temp_file
|
|
|
|
with_items: ${result.stdout_lines}
|
|
|
|
|
|
|
|
- action: command diff $small_file $temp_file
|
|
|
|
|
|
|
|
- action: file dest=$temp_file state=absent
|