misc: add script to copy SSH keys

This one has the advantage of actually working :)
I had to blacklist some hosts because they would either outright refuse
connections or would refuse my LDAP credentials.
This commit is contained in:
Yohaï-Eliel BERREBY 2020-05-03 11:17:10 +02:00
parent a77b2c4f0f
commit 29991141f5
3 changed files with 22 additions and 0 deletions

1
.gitignore vendored
View file

@ -1 +1,2 @@
*.retry
ldap-password.txt

17
copy-keys.sh Executable file
View file

@ -0,0 +1,17 @@
#!/bin/bash
set -e
# Grab valid unique hostnames from the Ansible inventory.
HOSTS=$(grep -ve '^[#\[]' hosts \
| grep -ve '^$' \
| grep -F adm.auro.re \
| grep -vf ssh-blacklist.txt \
| sort -u)
for host in $HOSTS; do
echo "Handling host $host"
# sshpass can be used for non-interactive password authentication.
# place your password in ldap-password.txt.
sshpass -f ldap-password.txt ssh-copy-id "$host"
done

4
ssh-blacklist.txt Normal file
View file

@ -0,0 +1,4 @@
ldap-replica-edc-backup.adm.auro.re
ldap-replica-fleming-backup.adm.auro.re
ldap-replica-gs.adm.auro.re
ldap-replica-gs-backup.adm.auro.re