2020-05-03 11:17:10 +02:00
|
|
|
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
|
|
|
|
# Grab valid unique hostnames from the Ansible inventory.
|
|
|
|
HOSTS=$(grep -ve '^[#\[]' hosts \
|
|
|
|
| grep -F adm.auro.re \
|
|
|
|
| sort -u)
|
|
|
|
|
2020-05-03 18:40:26 +02:00
|
|
|
# Ask password
|
|
|
|
read -s -p "Hello adventurer, what is your LDAP password? " passwd
|
|
|
|
echo
|
|
|
|
|
2020-05-03 11:17:10 +02:00
|
|
|
for host in $HOSTS; do
|
2020-05-03 18:40:26 +02:00
|
|
|
echo "[+] Handling host $host"
|
2020-05-03 11:17:10 +02:00
|
|
|
|
|
|
|
# sshpass can be used for non-interactive password authentication.
|
|
|
|
# place your password in ldap-password.txt.
|
2021-11-21 09:40:37 +01:00
|
|
|
SSHPASS=${passwd} sshpass -v -e ssh-copy-id "$host"
|
2020-05-03 11:17:10 +02:00
|
|
|
done
|
2020-05-03 18:40:26 +02:00
|
|
|
|