summaryrefslogtreecommitdiffstats
path: root/test/lookup_plugins.yml
diff options
context:
space:
mode:
authorJavier Candeira <javier@candeira.com>2013-03-08 10:08:28 +0100
committerJavier Candeira <javier@candeira.com>2013-03-10 03:36:53 +0100
commitca6c36e1ac2f6f4b72ec7167903d578468f28261 (patch)
treecef6e5294379120310c4c5c9eb175e250e55924b /test/lookup_plugins.yml
parentMerge pull request #2340 from niksite/devel (diff)
downloadansible-ca6c36e1ac2f6f4b72ec7167903d578468f28261.tar.xz
ansible-ca6c36e1ac2f6f4b72ec7167903d578468f28261.zip
password lookup plugin, with working tests and documentation
Diffstat (limited to 'test/lookup_plugins.yml')
-rw-r--r--test/lookup_plugins.yml22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/lookup_plugins.yml b/test/lookup_plugins.yml
index ae73552ab6..7d2141cc0d 100644
--- a/test/lookup_plugins.yml
+++ b/test/lookup_plugins.yml
@@ -55,3 +55,25 @@
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
+
+# password lookup plugin
+ - name: ensure test file doesn't exist
+ # command because file will return differently
+ action: command rm -f /tmp/ansible-test-with_password
+ - name: test LOOKUP and PASSWORD with non existing password file
+ action: command test "$LOOKUP(password, /tmp/ansible-test-with_password)" = "$PASSWORD(/tmp/ansible-test-with_password)"
+ - name: test LOOKUP and PASSWORD with existing password file
+ action: command test "$LOOKUP(password, /tmp/ansible-test-with_password)" = "$PASSWORD(/tmp/ansible-test-with_password)"
+ - name: now test existing password via $item and with_password
+ action: command test "$PASSWORD(/tmp/ansible-test-with_password)" = "$item"
+ with_password:
+ - /tmp/ansible-test-with_password
+ - name: cleanup test file
+ action: file path=/tmp/ansible-test-with_password state=absent
+ - name: now test a password of non-default length (default=20, but here length=8)
+ action: command test "$PASSWORD(/tmp/ansible-test-with_password length=8)" = "$LOOKUP(password, /tmp/ansible-test-with_password)"
+ # - name: did we really create a password of length=8?
+ # action: command test "`expr length $PASSWORD(/tmp/ansible-test-with_password)`" = "8"
+ - name: cleanup test file, again
+ action: file path=/tmp/ansible-test-with_password state=absent
+