SaltStack 安装使用测试教程之简单安装与配置(CentOS7)
1、介绍
Salt,,一种全新的基础设施管理方式,部署轻松,在几分钟内可运行起来,扩展性好,很容易管理上万台服务器,速度够快,服务器之间秒级通讯。
salt底层采用动态的连接总线, 使其可以用于编配, 远程执行, 配置管理等等.
2、环境说明
本次测试环境:
172.16.1.152 centos7 - salt master -salt minion
172.16.1.153 centos7 - salt minion
xx.xx.xx.xx windows server 2003 -salt minion
3、安装salt master
测试服务器分别关闭 selinux 以及防火墙
/usr/sbin/setenforce 0 立刻关闭 SELINUX
vim /etc/selinux/config 配置项 SELINUX=disabled 永久关闭selinux
systemctl stop firewalld 关闭防火墙
1、分别在centos环境上,安装slatstack 库
sudo yum install https://repo.saltstack.com/yum/redhat/salt-repo-latest-2.el7.noarch.rpm
2、运行命令 sudo yum clean expire-cache
3、yum安装master sudo yum install salt-master
已安装: salt-master.noarch 0:2017.7.4-1.el7 作为依赖被安装: PyYAML.x86_64 0:3.11-1.el7 libsodium.x86_64 0:1.0.5-1.el7 libtomcrypt.x86_64 0:1. libtommath.x86_64 0:0.42.0-6.el7 libyaml.x86_64 0:0.1.4-11.el7_0 openpgm.x86_64 0:5.2.12 python-babel.noarch 0:0.9.6-8.el7 python-futures.noarch 0:3.0.3-1.el7 python-jinja2.noarch 0: python-markupsafe.x86_64 0:0.11-10.el7 python-msgpack.x86_64 0:0.4.6-1.el7 python-psutil.x86_64 0: python-requests.noarch 0:2.6.0-1.el7_1 python-tornado.x86_64 0:4.2.1-1.el7 python-urllib3.noarch 0 python-zmq.x86_64 0:15.3.0-2.el7 python2-crypto.x86_64 0:2.6.1-15.el7 salt.noarch 0:2017.7.4- zeromq.x86_64 0:4.1.4-6.el7 完毕!
4、安装后的任务
1、配置自启动(centos7): systemctl enable salt-master.service (centos 6) :chkconfig salt-master on
2、启动master(centos7) :systemctl start salt-master.service (centos6 ): service salt-master start
[root@localhost /]# systemctl status salt-master.service ● salt-master.service - The Salt Master Server Loaded: loaded (/usr/lib/systemd/system/salt-master.service; enabled; vendor preset: disabled) Active: active (running) since 六 2018-03-31 12:09:58 CST; 15s ago Docs: man:salt-master(1) file:///usr/share/doc/salt/html/contents.html https://docs.saltstack.com/en/latest/contents.html Main PID: 18386 (salt-master) CGroup: /system.slice/salt-master.service ├─18386 /usr/bin/python /usr/bin/salt-master ├─18469 /usr/bin/python /usr/bin/salt-master ├─18478 /usr/bin/python /usr/bin/salt-master ├─18481 /usr/bin/python /usr/bin/salt-master ├─18489 /usr/bin/python /usr/bin/salt-master ├─18491 /usr/bin/python /usr/bin/salt-master ├─18492 /usr/bin/python /usr/bin/salt-master ├─18500 /usr/bin/python /usr/bin/salt-master ├─18501 /usr/bin/python /usr/bin/salt-master ├─18503 /usr/bin/python /usr/bin/salt-master ├─18504 /usr/bin/python /usr/bin/salt-master └─18507 /usr/bin/python /usr/bin/salt-master 3月 31 12:09:56 localhost.localdomain systemd[1]: Starting The Salt Master Server... 3月 31 12:09:58 localhost.localdomain systemd[1]: Started The Salt Master Server.
5、安装minion
1、在minion主机上 安装slatstack 库
2、yum安装master sudo yum install salt-minion
PS.同样可以使用yum安装以下的包: yum install salt-master yum install salt-minion yum install salt-ssh yum install salt-syndic yum install salt-cloud
6、配置 Salt
配置文件默认是存放到 /etc/salt 中,并以相应的组件 /etc/salt/master和 /etc/salt/minion 命名。
配置master
默认,salt master 监听所有Interfaces(0.0.0.0) 的4505 和4506 端口,如果想绑定指定的IP,修改/etc/salt/master 如下:
- #interface: 0.0.0.0 + interface: 10.0.0.1
修改完后,需要重启进程生效
systemctl restart salt-master.service
配置minion
修改配置文件/etc/salt/minion
master: 172.16.1.152
若有多个master,可以使用以下格式:
master: - address1 - address2
7、配置认证
在服务端执行命令,接收所有minion发送过来的KEY
[root@salt-master ~]# salt-key -A [root@salt-master ~]# salt-key -L Accepted Keys: salt-master salt-minion1 Denied Keys: Unaccepted Keys: Rejected Keys:
到此,salt的简单安装与配置已经完成
上一篇: 今天教女朋友游泳