summaryrefslogtreecommitdiffstats
path: root/test/lookup_plugins.yml
diff options
context:
space:
mode:
authorDaniel Hokka Zakrisson <daniel@hozac.com>2012-11-04 16:01:58 +0100
committerDaniel Hokka Zakrisson <daniel@hozac.com>2012-11-07 23:21:26 +0100
commit43419d7b20e52ad3d009f8f4884b7595d216b5df (patch)
tree2361105cd24d8791b7f46cfdf6f3a871ba508d7c /test/lookup_plugins.yml
parentAdd $LOOKUP(<lookup plugin>,<data>) as a templating option (diff)
downloadansible-43419d7b20e52ad3d009f8f4884b7595d216b5df.tar.xz
ansible-43419d7b20e52ad3d009f8f4884b7595d216b5df.zip
Add tests for lookup plugins
Diffstat (limited to 'test/lookup_plugins.yml')
-rw-r--r--test/lookup_plugins.yml37
1 files changed, 37 insertions, 0 deletions
diff --git a/test/lookup_plugins.yml b/test/lookup_plugins.yml
new file mode 100644
index 0000000000..e934fac145
--- /dev/null
+++ b/test/lookup_plugins.yml
@@ -0,0 +1,37 @@
+# simple test of lookup plugins in with_*
+---
+- hosts: all
+ vars:
+ empty_list: []
+ tasks:
+ - name: test with_items
+ action: command true
+ with_items:
+ - 1
+ - 2
+ - 3
+ - name: test with_items with empty list
+ action: command true
+ with_items: $empty_list
+
+ - name: test with_file and FILE
+ action: command test "$item" = "$FILE(sample.j2)"
+ with_file: sample.j2
+
+ - name: test with_pipe
+ action: command test "$item" = "$PIPE(cat sample.j2)"
+ with_pipe: cat sample.j2
+
+ - name: test LOOKUP and PIPE
+ action: command test "$LOOKUP(pipe, cat sample.j2)" = "$PIPE(cat sample.j2)"
+
+ - name: ensure test file doesnt exist
+ # command because file will return differently
+ action: command rm -f /tmp/ansible-test-with_lines-data
+ - name: test with_lines
+ action: shell echo "$item" >> /tmp/ansible-test-with_lines-data
+ with_lines: cat sample.j2
+ - name: verify with_lines
+ action: copy src=sample.j2 dest=/tmp/ansible-test-with_lines-data
+ - name: cleanup test file
+ action: file path=/tmp/ansible-test-with_lines-data state=absent