Debian Codegraph @

test/integration/targets/user/tasks/test_ssh_key_passphrase.yml

raw
1 # Test creating ssh key with passphrase
2 - name: Remove ansibulluser
3 user:
4 name: ansibulluser
5 state: absent
6
7 - name: Create user with ssh key
8 user:
9 name: ansibulluser
10 state: present
11 generate_ssh_key: yes
12 force: yes
13 ssh_key_file: .ssh/test_id_rsa
14 ssh_key_passphrase: secret_passphrase
15 register: ansibulluser_create_with_ssh_key
16
17 - name: Unlock ssh key
18 command: "ssh-keygen -y -f {{ ansibulluser_create_with_ssh_key.ssh_key_file|quote }} -P secret_passphrase"
19 register: result
20
21 - name: Check that ssh key was unlocked successfully
22 assert:
23 that:
24 - result.rc == 0
25
26 - name: Clean ssh key
27 file:
28 path: "{{ ansibulluser_create_with_ssh_key.ssh_key_file }}"
29 state: absent
30 when: ansible_os_family == 'FreeBSD'