summaryrefslogtreecommitdiffstats
path: root/test/integration/targets/user/tasks/test_ssh_key_passphrase.yml
diff options
context:
space:
mode:
Diffstat (limited to 'test/integration/targets/user/tasks/test_ssh_key_passphrase.yml')
-rw-r--r--test/integration/targets/user/tasks/test_ssh_key_passphrase.yml30
1 files changed, 30 insertions, 0 deletions
diff --git a/test/integration/targets/user/tasks/test_ssh_key_passphrase.yml b/test/integration/targets/user/tasks/test_ssh_key_passphrase.yml
new file mode 100644
index 0000000..f0725ed
--- /dev/null
+++ b/test/integration/targets/user/tasks/test_ssh_key_passphrase.yml
@@ -0,0 +1,30 @@
+# Test creating ssh key with passphrase
+- name: Remove ansibulluser
+ user:
+ name: ansibulluser
+ state: absent
+
+- name: Create user with ssh key
+ user:
+ name: ansibulluser
+ state: present
+ generate_ssh_key: yes
+ force: yes
+ ssh_key_file: .ssh/test_id_rsa
+ ssh_key_passphrase: secret_passphrase
+ register: ansibulluser_create_with_ssh_key
+
+- name: Unlock ssh key
+ command: "ssh-keygen -y -f {{ ansibulluser_create_with_ssh_key.ssh_key_file|quote }} -P secret_passphrase"
+ register: result
+
+- name: Check that ssh key was unlocked successfully
+ assert:
+ that:
+ - result.rc == 0
+
+- name: Clean ssh key
+ file:
+ path: "{{ ansibulluser_create_with_ssh_key.ssh_key_file }}"
+ state: absent
+ when: ansible_os_family == 'FreeBSD'