From 82ab756b42045a93c5c545cb97d647d5b062e2d6 Mon Sep 17 00:00:00 2001 From: Mischa ter Smitten Date: Tue, 12 Apr 2022 15:44:56 +0200 Subject: [PATCH] Skip some test in vagrant --- tests/tasks/post.yml | 44 +++++++++++++++++++++++++++----------------- 1 file changed, 27 insertions(+), 17 deletions(-) diff --git a/tests/tasks/post.yml b/tests/tasks/post.yml index f31d893..b65089a 100644 --- a/tests/tasks/post.yml +++ b/tests/tasks/post.yml @@ -1,24 +1,34 @@ # post test file --- -- name: test presence of private key - shell: > - diff {{ ssh_keys_private_keys[0]['src'] }} ~dummy/.ssh/{{ ssh_keys_private_keys[0]['src'] | basename }} - && (echo 'Private key test: pass' && exit 0) - || (echo 'Private key test: fail' && exit 1) - args: - warn: false +- name: set fact + command: > + echo "{{ ansible_connection }}" + register: _ansible_connection changed_when: false - tags: - - skip_ansible_lint -- name: test presence of public key - shell: > - diff {{ ssh_keys_public_keys[0]['src'] }} ~dummy/.ssh/{{ ssh_keys_public_keys[0]['src'] | basename }} - && (echo 'Public key test: pass' && exit 0) - || (echo 'Public key test: fail' && exit 1) - args: - warn: false - changed_when: false +- block: + + - name: test presence of private key + shell: > + diff {{ ssh_keys_private_keys[0]['src'] }} ~dummy/.ssh/{{ ssh_keys_private_keys[0]['src'] | basename }} + && (echo 'Private key test: pass' && exit 0) + || (echo 'Private key test: fail' && exit 1) + args: + warn: false + changed_when: false + tags: + - skip_ansible_lint + + - name: test presence of public key + shell: > + diff {{ ssh_keys_public_keys[0]['src'] }} ~dummy/.ssh/{{ ssh_keys_public_keys[0]['src'] | basename }} + && (echo 'Public key test: pass' && exit 0) + || (echo 'Public key test: fail' && exit 1) + args: + warn: false + changed_when: false + + when: _ansible_connection.stdout != 'ssh' tags: - skip_ansible_lint