自动化中使用ssh命令

有一台master服务器,做自动部署,其中一个环节是使用ssh命令链接新装完系统的服务器,做一些初始化工作,但是由于dhcp池会重复分配IP,ssh在脚本中会报如下两个错误。

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that the RSA host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
j8:98:o8:cm:23:16:62:cd.
Please contact your system administrator.
Add correct host key in /root/.ssh/known_hosts to get rid of this message.
Offending key in /root/.ssh/known_hosts:6
RSA host key for 10.0.0.13 has changed and you have requested strict checking.
Host key verification failed.

The authenticity of host '10.0.0.13 (10.0.0.13)' can't be established.
RSA key fingerprint is j8:98:o8:cm:23:16:62:cd.
Are you sure you want to continue connecting (yes/no)?

在ssh配置文件中添加如下两行:
~/.ssh/config

StrictHostKeyChecking no
UserKnownHostsFile /dev/null