#!/bin/bash
set +x
base_dir=$(pwd)
ip_list='10.200.7.28,10.200.7.29,10.200.7.30,10.200.7.31'
USER='root'
PWD='123456'
INSTALL()
{
echo "开始导入public-key"
sleep 1s
for IP in `echo "${ip_list}"|awk -F, 'BEGIN{OFS=" "}{$1=$1;printf("%s",$0);}'`
do
sshpass -p ${PWD} ssh-copy-id -o StrictHostKeyChecking=no ${USER}@${IP}
echo "${IP}服务器完成"
done
}
INSTALL