#!/bin/bash

install_sshpass(){
   rpm -Uvh Install_Packages/sshpass-1.06-2.el7.x86_64.rpm
}


ssh_key_create(){
   if [ ! -f /root/.ssh/id_rsa ];then
        ssh-keygen -t rsa  -P '' -f ~/.ssh/id_rsa
   fi
}

ssh_key_config(){
    install_sshpass              
    ssh_key_create
    for ip in ${IP_LIST[@]}
    do 
      sed -i /${ip}/d /root/.ssh/known_hosts &> /dev/null
      sshpass -p ${PASSWORD} ssh-copy-id ${SSH_OPT} root@${ip}
    done
}
