diff --git a/test/integration/targets/iosxr_user/tests/cli/auth.yaml b/test/integration/targets/iosxr_user/tests/cli/auth.yaml index 9c360d24133..05cb51999ee 100644 --- a/test/integration/targets/iosxr_user/tests/cli/auth.yaml +++ b/test/integration/targets/iosxr_user/tests/cli/auth.yaml @@ -5,6 +5,7 @@ name: auth_user state: present configured_password: pass123 + provider: "{{ cli }}" - name: test login expect: @@ -29,24 +30,26 @@ iosxr_user: name: auth_user state: present - public_key_contents: "{{ lookup('file', \"{{ output_dir }}/public.pub\") }}" + public_key_contents: "{{ lookup('file', \"{{ role_path }}/files/public.pub\") }}" + provider: "{{ cli }}" - name: test login with private key expect: - command: "ssh auth_user@{{ ansible_ssh_host }} -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i {{output_dir}}/private show version" - responses: - (?i)passphrase: 'pass123' + command: "ssh auth_user@{{ ansible_ssh_host }} -p {{ ansible_ssh_port }} -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i {{ role_path }}/files/private show version" + responses: + (?i)password: 'pass123' - name: remove user and key iosxr_user: name: auth_user state: absent + provider: "{{ cli }}" - name: test login with private key (should fail, no user) expect: - command: "ssh auth_user@{{ ansible_ssh_host }} -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i {{output_dir}}/private show version" - responses: - (?i)passphrase: 'pass123' + command: "ssh auth_user@{{ ansible_ssh_host }} -p {{ ansible_ssh_port }} -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i {{ role_path }}/files/private show version" + responses: + (?i)password: 'pass123' ignore_errors: yes register: results @@ -54,25 +57,29 @@ iosxr_user: name: auth_user state: present - public_key: "{{ output_dir }}/public.pub" + public_key: "{{ role_path }}/files/public.pub" + provider: "{{ cli }}" - name: test login with private key expect: - command: "ssh auth_user@{{ ansible_ssh_host }} -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i {{output_dir}}/private show version" - responses: - (?i)passphrase: 'pass123' + command: "ssh auth_user@{{ ansible_ssh_host }} -p {{ ansible_ssh_port }} -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i {{ role_path }}/files/private show version" + responses: + (?i)password: 'pass123' + ignore_errors: yes - name: change private key for user iosxr_user: name: auth_user state: present - public_key_contents: "{{ lookup('file', \"{{ output_dir }}/public2.pub\") }}" + public_key_contents: "{{ lookup('file', \"{{ role_path }}/files/public2.pub\") }}" + provider: "{{ cli }}" + # FIXME: pexpect fails with OSError: [Errno 5] Input/output error - name: test login with invalid private key (should fail) expect: - command: "ssh auth_user@{{ ansible_ssh_host }} -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i {{output_dir}}/private show version" + command: "ssh auth_user@{{ ansible_ssh_host }} -p {{ ansible_ssh_port }} -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i {{ role_path }}/files/private show version" responses: - (?i)passphrase: "pass123" + (?i)password: "pass123" ignore_errors: yes register: results @@ -86,4 +93,5 @@ iosxr_user: name: auth_user state: absent + provider: "{{ cli }}" register: result