From b7f9037b5bd31ca54a883b05dc5957551a378032 Mon Sep 17 00:00:00 2001 From: jctanner Date: Mon, 20 Jun 2016 21:12:45 -0400 Subject: [PATCH] Add test for multi-options in authorized_key (#16375) Addresses https://github.com/ansible/ansible-modules-core/issues/1715 --- .../roles/test_authorized_key/tasks/main.yml | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/test/integration/roles/test_authorized_key/tasks/main.yml b/test/integration/roles/test_authorized_key/tasks/main.yml index ccd59735d4b..9b2c2450823 100644 --- a/test/integration/roles/test_authorized_key/tasks/main.yml +++ b/test/integration/roles/test_authorized_key/tasks/main.yml @@ -242,3 +242,31 @@ that: - 'result.changed == False' +# ------------------------------------------------------------- +# basic ssh-dss key with mutliple permit-open options +# https://github.com/ansible/ansible-modules-core/issues/1715 + +- name: add basic ssh-dss key with multi-opts + authorized_key: + user: root + key: "{{ dss_key_basic }}" + key_options: 'no-agent-forwarding,no-X11-forwarding,permitopen="10.9.8.1:8080",permitopen="10.9.8.1:9001"' + state: present + path: "{{output_dir|expanduser}}/authorized_keys" + register: result + +- name: assert that the key with multi-opts was added + assert: + that: + - 'result.changed == True' + - 'result.key == dss_key_basic' + - 'result.key_options == "no-agent-forwarding,no-X11-forwarding,permitopen=\"10.9.8.1:8080\",permitopen=\"10.9.8.1:9001\""' + +- name: get the file content + shell: cat "{{output_dir|expanduser}}/authorized_keys" | fgrep DATA_BASIC + register: content + +- name: validate content + assert: + that: + - 'content.stdout == "no-agent-forwarding,no-X11-forwarding,permitopen=\"10.9.8.1:8080\",permitopen=\"10.9.8.1:9001\" ssh-dss DATA_BASIC root@testing"'