From d25e63270e7e4ee1ba639c93a96f5072e87f4d11 Mon Sep 17 00:00:00 2001 From: Sergey Date: Sat, 2 Sep 2023 14:39:08 -0400 Subject: [PATCH] Docs: fix unclearence add example with reletive pathes #483 --- plugins/modules/authorized_key.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/plugins/modules/authorized_key.py b/plugins/modules/authorized_key.py index 424ee4a..375c977 100644 --- a/plugins/modules/authorized_key.py +++ b/plugins/modules/authorized_key.py @@ -29,7 +29,9 @@ options: path: description: - Alternate path to the authorized_keys file. - - When unset, this value defaults to I(~/.ssh/authorized_keys). + - When unset, this value defaults to I(~user/.ssh/authorized_keys). + - To set this value please define "absolute path" + or use I(~user/.ssh/authorized_keys)(where user is your target user_name). type: path manage_dir: description: @@ -88,6 +90,13 @@ EXAMPLES = r''' state: present key: "{{ lookup('file', '/home/charlie/.ssh/id_rsa.pub') }}" +- name: Set authorized key taken from file predefined target path + ansible.posix.authorized_key: + user: charlie + state: present + key: "{{ lookup('file', '/home/charlie/.ssh/id_rsa.pub') }}" + path: ~charlie/.ssh/authorized_keys + - name: Set authorized keys taken from url ansible.posix.authorized_key: user: charlie @@ -204,7 +213,7 @@ validate_certs: # ========= # user = username # key = line to add to authorized_keys for user -# path = path to the user's authorized_keys file (default: ~/.ssh/authorized_keys) +# path = path to the user's authorized_keys file (default: ~user/.ssh/authorized_keys) # manage_dir = whether to create, and control ownership of the directory (default: true) # state = absent|present (default: present) #