一、salt安装:
1
2
3
4
5
|
apt
-
get install python
-
software
-
properties
add
-
apt
-
repository ppa:saltstack
/
salt
apt
-
get update
apt
-
get install salt
-
master
#服务端
apt
-
get install salt
-
minion
#客户端
|
二、salt配置:
服务端的配置:vi /etc/salt/master
1
2
|
interface:
0.0
.
0.0
auto_accept:
True
|
设置监听IP及打开自动通过验证,然后启动/etc/init.d/salt-master start
客户端的配置: vi /etc/salt/minion
1
2
|
master:
192.168
.
1.100
id:
192.168
.
1.101
|
master是设置服务端的IP,id是服务端显示用的可以随意写,不过我为了好区分机器是配了本机的IP地址,然后启动:/etc/init.d/salt-minion start
三、简单试用:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
root@ubuntu:~# salt-key -L
Accepted Keys:
192.168.1.101
Unaccepted Keys:
ubuntu
Rejected Keys:
root@ubuntu:~# salt
'*'
cmd.run
"df -lh"
192.168.1.101:
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 128G 3.6G 118G 3% /
none 5.9G 184K 5.9G 1% /dev
none 5.9G 0 5.9G 0% /dev/shm
none 5.9G 56K 5.9G 1% /
var
/run
none 5.9G 0 5.9G 0% /
var
/lock
none 5.9G 0 5.9G 0% /lib/init/rw
none 128G 3.6G 118G 3% /
var
/lib/ureadahead/debugfs
/dev/sda1 184M 22M 154M 13% /boot
root@ubuntu:~#
|
salt-key 可以查看通过验证的机器
salt是主程序,可以很方便对多台机器进行管理
本文转自运维笔记博客51CTO博客,原文链接http://blog.51cto.com/lihuipeng/1316775如需转载请自行联系原作者
lihuipeng