From e690a9ccd1cafb04fcc9c458495e6512b917fd87 Mon Sep 17 00:00:00 2001 From: Thomas Constans Date: Tue, 5 May 2020 22:56:40 +0200 Subject: [PATCH] adhoc: use copy module with content --- 6_adhoc.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/6_adhoc.txt b/6_adhoc.txt index 0095f5b..3f59f05 100644 --- a/6_adhoc.txt +++ b/6_adhoc.txt @@ -2,5 +2,7 @@ ansible all -u root -k -m user -a "user=ansible password={{ 'ansible'|password_h ansible all -u root -k -m lineinfile -a "path=/etc/sudoers.d/ansible state=present create=yes line='ansible ALL=(ALL) NOPASSWD: ALL' validate='/usr/sbin/visudo -cf %s'" +ansible all -u root -k -m copy -a "dest=/etc/sudoers.d/ansible content='ansible ALL=(ALL) NOPASSWD: ALL' validate='/usr/sbin/visudo -cf %s" + ansible all -u root -k -m authorized_key -a "key={{ lookup( 'file', '/root/.ssh/id_rsa.pub') }} user=ansible"