首页 > 其他 > 详细

k8s 之ansible (十)

时间:2020-06-07 17:22:56      阅读:48      评论:0      收藏:0      [点我收藏+]

1.hdss7-200创建密钥

[root@hdss7-200 ~]# ssh-keygen -t dsa 一路回车

分发脚本

#!/bin/bash
. /etc/rc.d/init.d/functions

\rm ~/.ssh/id_rsa* -f
ssh-keygen -t rsa -f ~/.ssh/id_rsa -N "" -q
for ip in 11 12 12 22
do
sshpass -p123456 ssh-copy-id -i ~/.ssh/id_rsa.pub " root@192.168.12.$ip -o StrictHostKeyChecking=no " &>/dev/null
if [ $? -eq 0 ];then
action "fenfa 192.168.12.$ip" /bin/true
else
action "fenfa 192.168.12.$ip" /bin/false
fi
echo ""
done

2.安装ansible 

[root@hdss7-200 ~]# yum install ansible -y

[root@hdss7-200 ~]# cat /etc/ansible/hosts

[k8s]
192.168.12.11
192.168.12.12
192.168.12.21
192.168.12.22

[root@hdss7-200 ~]# ansible k8s -a ‘w‘

k8s 之ansible (十)

原文:https://www.cnblogs.com/sseban/p/13061237.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!