-
Notifications
You must be signed in to change notification settings - Fork 155
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow remote path for authorized_key
- Loading branch information
1 parent
97c0228
commit 5f3f851
Showing
5 changed files
with
62 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--- | ||
minor_changes: | ||
- authorized_keys - allow using absolute path to a file as a SSH key(s) source (https://github.com/ansible-collections/ansible.posix/pull/568) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
tests/integration/targets/authorized_key/tasks/check_path.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
--- | ||
- name: Create key file for test | ||
ansible.builtin.copy: | ||
dest: "{{ key_path }}" | ||
content: "{{ rsa_key_basic }}" | ||
mode: "0600" | ||
|
||
- name: Add key using path | ||
ansible.posix.authorized_key: | ||
user: root | ||
key: file://{{ key_path }} | ||
state: present | ||
path: "{{ output_dir | expanduser }}/authorized_keys" | ||
register: result | ||
|
||
- name: Assert that the key was added | ||
ansible.builtin.assert: | ||
that: | ||
- result.changed == true | ||
|
||
- name: Add key using path again | ||
ansible.posix.authorized_key: | ||
user: root | ||
key: file://{{ key_path }} | ||
state: present | ||
path: "{{ output_dir | expanduser }}/authorized_keys" | ||
register: result | ||
|
||
- name: Assert that no changes were applied | ||
ansible.builtin.assert: | ||
that: | ||
- result.changed == false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters