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"