Update to support testing

This commit is contained in:
2020-04-02 09:37:46 +13:00
parent 5f958da555
commit 9a35429f77
2 changed files with 32 additions and 4 deletions

View File

@@ -3,7 +3,26 @@
- name: Verify
hosts: all
pre_tasks:
- name: Create test user
shell:
cmd: adduser "auth_duo_test" && echo "password" | passwd "auth_duo_test" --stdin
tasks:
- name: Example assertion
- name: Try and Login as test user
shell: |
/usr/bin/sshpass -v -p password \
/usr/bin/ssh -tt -o "UserKnownHostsFile=/dev/null" \
-o "StrictHostKeyChecking=no" \
auth_duo_test@localhost > /tmp/sshtest 2>&1 | tee /tmp/sshtest
async: 20
poll: 10
ignore_errors: true
- name: Retrieve SSH login info from file
slurp:
src: /tmp/sshtest
register: slurpfile
- name: Did duo prompt show?
assert:
that: true
that: "'Duo two-factor login for auth_duo_test' in slurpfile['content'] | b64decode"