Created
October 24, 2013 05:37
-
-
Save rothgar/7131900 to your computer and use it in GitHub Desktop.
Ansible one liners
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
###Deploy SSH key to ansible inventory### | |
for server in $(ansible --list-hosts all); do ssh-copy-id -i ~/.ssh/id_rsa.pub $server; done |
Alternatively if you've got SSHPass installed you can put the password in a clear text file (temporarily, and don't forget your chmod 600 before and shred when done) and then use the following (change the -P10 to the match the number of forks you want to run):
ansible all --list-hosts | xargs -n1 -P10 sshpass -f temporary_password_file ssh-copy-id -i ~/.ssh/id_rsa.pub
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
this way its also parallel to # of forks you use in ansible: