summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjctanner <tanner.jc@gmail.com>2016-06-20 21:12:45 -0400
committerGitHub <noreply@github.com>2016-06-20 21:12:45 -0400
commitb7f9037b5bd31ca54a883b05dc5957551a378032 (patch)
tree91223b2807571b5b7b8dec17179df9dfc1ff18ce
parentb1d32e6e326d2f99b415c20455db9227c567683c (diff)
downloadansible-b7f9037b5bd31ca54a883b05dc5957551a378032.tar.gz
Add test for multi-options in authorized_key (#16375)
Addresses https://github.com/ansible/ansible-modules-core/issues/1715
-rw-r--r--test/integration/roles/test_authorized_key/tasks/main.yml28
1 files changed, 28 insertions, 0 deletions
diff --git a/test/integration/roles/test_authorized_key/tasks/main.yml b/test/integration/roles/test_authorized_key/tasks/main.yml
index ccd59735d4..9b2c245082 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"'