From f10413b9198da52fcd235effc7e9517de3958543 Mon Sep 17 00:00:00 2001 From: Marcos Diez Date: Tue, 12 Jul 2016 09:52:00 -0300 Subject: [PATCH] better authorized_keys documentation (#3739) --- lib/ansible/modules/system/authorized_key.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/lib/ansible/modules/system/authorized_key.py b/lib/ansible/modules/system/authorized_key.py index f758eeb9406..c92b2160a4a 100644 --- a/lib/ansible/modules/system/authorized_key.py +++ b/lib/ansible/modules/system/authorized_key.py @@ -125,12 +125,9 @@ EXAMPLES = ''' with_file: - public_keys/doe-jane -# Copies the key from the user who is running ansible to the remote machine -- set_fact: - my_ssh_key: "{{ lookup('env','HOME') }}/.ssh/id_rsa.pub" - -- authorized_key: user=ubuntu key="{{ lookup('file', my_ssh_key) }}" - sudo: yes +# Copies the key from the user who is running ansible to the remote machine user ubuntu +- authorized_key: user=ubuntu key="{{ lookup('file', lookup('env','HOME') + "/.ssh/id_rsa.pub") }}" + become: yes '''