You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
468 B
Bash
21 lines
468 B
Bash
#!/bin/bash
|
|
set -e
|
|
|
|
# Grab valid unique hostnames from the Ansible inventory.
|
|
HOSTS=$(grep -ve '^[#\[]' hosts \
|
|
| grep -F adm.auro.re \
|
|
| sort -u)
|
|
|
|
# Ask password
|
|
read -s -p "Hello adventurer, what is your LDAP password? " passwd
|
|
echo
|
|
|
|
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=${passwd} sshpass -v -e ssh-copy-id "$host"
|
|
done
|
|
|