Commit 20be2f9f by tingweiwang

解决add_node.sh 脚本ansible hosts主机没换行

1 parent 8868a4a7
Showing with 4 additions and 4 deletions
...@@ -11,17 +11,17 @@ port=22 ...@@ -11,17 +11,17 @@ port=22
password=seetatech password=seetatech
for ip in ${new_node[@]} for ip in ${new_node[@]}
do do
sshpass -p $password ssh-copy-id -i ~/.ssh/id_rsa.pub -p $port -o StrictHostKeyChecking=no root@$ip sshpass -p $password ssh-copy-id -i ~/.ssh/id_rsa.pub -p $port -o StrictHostKeyChecking=no root@$ip
done done
##############根据new_node节点清单自动配置ansible hosts################################ ##############根据new_node节点清单自动配置ansible hosts################################
for ansible_new_node in ${new_node[@]} for ansible_new_node in ${new_node[@]}
do do
if ! grep -qF "$ansible_new_node" /etc/ansible/hosts; then if ! grep -qF "$ansible_new_node" /etc/ansible/hosts; then
cat >>/etc/ansible/hosts<<EOF cat >>/etc/ansible/hosts<<EOF
$ansible_new_node $ansible_new_node
EOF EOF
else echo "您已配置该node:$ansible_new_node 信息到ansible hosts文件,已跳过该步骤" else echo "您已配置该node:$ansible_new_node 信息到ansible hosts文件,已跳过该步骤"
fi fi
done done
echo "您有6s的时间,请确认当前ansible hosts为: " echo "您有6s的时间,请确认当前ansible hosts为: "
cat /etc/ansible/hosts && sleep 6 cat /etc/ansible/hosts && sleep 6
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!