From b49ef552248d8355f21c05457af1297e6c1e3d78 Mon Sep 17 00:00:00 2001 From: Thomas Constans Date: Wed, 27 Jun 2018 15:26:33 +0200 Subject: [PATCH] rajout exercice "commandes adhoc" --- 6_adhoc.txt | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 6_adhoc.txt diff --git a/6_adhoc.txt b/6_adhoc.txt new file mode 100644 index 0000000..5565025 --- /dev/null +++ b/6_adhoc.txt @@ -0,0 +1,6 @@ +ansible centos2 -u root -k -m user -a "user=ansible password={{ 'ansible'|password_hash('sha512') }} create_home=yes home=/home/ansible" + +ansible centos2 -u root -k -m lineinfile -a "path=/etc/sudoers.d/ansible state=present create=yes line='ansible ALL=(ALL) NOPASSWD: ALL'" + +ansible centos2 -u root -k -m authorized_key -a "key={{ lookup( 'file', '/root/.ssh/id_rsa.pub') }} user=ansible" +