Created
October 25, 2015 11:04
-
-
Save m0r13/f1b05db64cfaaa53c002 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
key=$(cat $2) | |
ssh -t $1 "sudo useradd -d /var/lib/ansible -m -u 999 ansible; \ | |
echo 'ansible ALL=NOPASSWD: ALL' | sudo tee /etc/sudoers.d/ansible; \ | |
sudo mkdir /var/lib/ansible/.ssh; \ | |
echo '$key' | sudo tee /var/lib/ansible/.ssh/authorized_keys; \ | |
sudo chown -R ansible:ansible /var/lib/ansible/.ssh;" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment