前提条件: 安装对应的虚拟机、或者主机服务器,进行ip配置,主机名修改(这里就不做介绍了)
一、安装salt-master 和salt-minion
主机比较少的话,可以手动配置,这里不做介绍,只介绍salt-ssh 多台操作情形:
主机多,不方便手动一台一台安装salt-minion,因为太费时费事,,这里通过salt-ssh安装salt-minion
前置条件:
虚拟机的防火墙都处于关闭状态,没关闭可以使用命令:chkconfig iptables off 和 chkconfig ip6tables off 关闭
操作环境:
以下所有命令都是在主机zk_vm_1上执行
作用:
实现一台机器批量操作其余多台机器,方便,省去繁琐的执行重复工作,
我这里使用演示主机为:
master 192.168.40.131
zk_vm_2 192.168.40.132
zk_vm_3 192.168.80.128
zk_vm_4 192.168.40.130
1、在打算安装salt-master的主机(zk_vm_1)上安装salt-ssh
在虚拟机或者主机原有的yum源中是没有salt安装包的,想要yum安装,必须安装其对应 的yum源
[root@root yum.repos.d]# rpm -ivh http://mirrors.zju.edu.cn/epel/6/x86_64/epel-release-6-8.noarch.rpm
Retrieving http://mirrors.zju.edu.cn/epel/6/x86_64/epel-release-6-8.noarch.rpm
warning: /var/tmp/rpm-tmp.UkMjZh: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Preparing... ########################################### [100%]
1:epel-release ########################################### [100%]
[root@root yum.repos.d]# yum list |grep salt
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Repository contrib is listed more than once in the configuration
python-salttesting.noarch 2015.7.10-1.el6 epel
salt.noarch 2015.5.10-2.el6 epel
salt-api.noarch 2015.5.10-2.el6 epel
salt-cloud.noarch 2015.5.10-2.el6 epel
salt-master.noarch 2015.5.10-2.el6 epel
salt-minion.noarch 2015.5.10-2.el6 epel
salt-ssh.noarch 2015.5.10-2.el6 epel
salt-syndic.noarch 2015.5.10-2.el6 epel
[root@root yum.repos.d]#
现在可以进行安装了,先安装salt-ssh
[root@root yum.repos.d]# yum install salt-ssh
已加载插件:fastestmirror
设置安装进程
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Repository contrib is listed more than once in the c