Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
tingweiwang
/
k8s
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 20be2f9f
authored
Sep 27, 2020
by
tingweiwang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
解决add_node.sh 脚本ansible hosts主机没换行
1 parent
8868a4a7
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
script/k8s/add_node.sh
script/k8s/add_node.sh
View file @
20be2f9
...
...
@@ -11,17 +11,17 @@ port=22
password
=
seetatech
for
ip
in
${
new_node
[@]
}
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
##############根据new_node节点清单自动配置ansible hosts################################
for
ansible_new_node
in
${
new_node
[@]
}
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
$ansible_new_node
EOF
else
echo
"您已配置该node:
$ansible_new_node
信息到ansible hosts文件,已跳过该步骤"
fi
else
echo
"您已配置该node:
$ansible_new_node
信息到ansible hosts文件,已跳过该步骤"
fi
done
echo
"您有6s的时间,请确认当前ansible hosts为: "
cat /etc/ansible/hosts
&&
sleep 6
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment