3254rf 发表于 2016-2-19 08:47:09

ubuntu14.04安装saltstack

1:操作系统环境

1
2
3
4
5
6
7
8
9
10
11
root@iZ23f6c5z8tZ:~# lsb_release -a
No LSB modules are available.
Distributor ID:Ubuntu
Description:Ubuntu 14.04.2 LTS
Release:14.04
Codename:trusty
root@iZ23f6c5z8tZ:/etc/apt# uname -m
x86_64
root@iZ23f6c5z8tZ:/etc/apt# uname -r
3.13.0-32-generic
注:机器操作系统均为ubuntu14.04 64bit





角色

1
2
192.168.1.10      salt-master
192.168.1.11      salt-minion-node1







2:安装salt-master

1
2
更新
root@iZ23f6c5z8tZ:~# apt-get update





1
2
root@iZ23f6c5z8tZ:~# apt-get install software-properties-common
注意从Ubuntu 12.10(Raring Ringtail)开始, add-apt-repository 在作为一部分包含在 software-properties-common 包里。





1
2
安装salt-master
root@iZ23f6c5z8tZ:~# apt-get install salt-master -y






查看salt-master程序

1
2
3
4
5
6
7
8
9
10
11
root@iZ23f6c5z8tZ:~# ps -ef|grep salt
root      4452   10 16:46 ?      00:00:02 /usr/bin/python /usr/bin/salt-master
root      446144520 16:46 ?      00:00:00 /usr/bin/python /usr/bin/salt-master
root      446844520 16:46 ?      00:00:00 /usr/bin/python /usr/bin/salt-master
root      446944520 16:46 ?      00:00:00 /usr/bin/python /usr/bin/salt-master
root      447044520 16:46 ?      00:00:00 /usr/bin/python /usr/bin/salt-master
root      447144520 16:46 ?      00:00:00 /usr/bin/python /usr/bin/salt-master
root      447644520 16:46 ?      00:00:00 /usr/bin/python /usr/bin/salt-master
root      447744520 16:46 ?      00:00:00 /usr/bin/python /usr/bin/salt-master
root      447844520 16:46 ?      00:00:00 /usr/bin/python /usr/bin/salt-master
root      481613760 17:04 pts/1    00:00:00 grep --color=auto salt





master启动后默认监听4505和4506两个端口。4505(publish_port)为salt的消息发布系统,4506(ret_port)为salt客户端与服务端通信的端口。

1
2
3
root@iZ23f6c5z8tZ:~# netstat -ntpl|grep python
tcp      0      0 0.0.0.0:4505            0.0.0.0:*               LISTEN      4468/python   
tcp      0      0 0.0.0.0:4506            0.0.0.0:*               LISTEN      4452/python





salt-master配置文件

1
2
3
4
5
6
root@iZ23f6c5z8tZ:/etc/salt# pwd
/etc/salt
root@iZ23f6c5z8tZ:/etc/salt# ls
mastermaster.bakmaster.dpki
root@iZ23f6c5z8tZ:/etc/salt# grep'^' /etc/salt/master
interface: 121.40.139.41//监听IP






重启salt-master

1
2
3
root@iZ23f6c5z8tZ:/etc/salt# service salt-master restart
salt-master stop/waiting
salt-master start/running, process 5009







4:安装salt-minion

1
2
root@iZ2803zsab7Z:~# apt-get update
root@iZ2803zsab7Z:~# apt-get install salt-minion -y




salt-minion状态

1
2
root@iZ2803zsab7Z:~# service salt-minion status
salt-minion start/running, process 4305





salt-minion配置文件

1
2
3
4
5
6
7
root@iZ2803zsab7Z:/etc/salt# pwd
/etc/salt
root@iZ2803zsab7Z:/etc/salt# ls
minionminion.bakminion.dminion_idpki
root@iZ2803zsab7Z:/etc/salt# grep '^' minion
master: 121.40.139.41//连接master端IP地址
注:id是客户端主机名(其实也就是认证key的名字)用来和master进行认证,如果没有更改的话。会找minion主机名作为





以上就是salt的master和minion安装




1
2
3
4
5
root@iZ23f6c5z8tZ:~# salt-key -L//查看minion列表
Accepted Keys:
Unaccepted Keys:
iZ2803zsab7Z
Rejected Keys:






1
2
3
4
5
6
root@iZ23f6c5z8tZ:~# salt-key -A//接受所有key,在提示中提示y确认即可.接下来便可以向minion发送命令了,-a 指定单个
The following keys are going to be accepted:
Unaccepted Keys:
iZ2803zsab7Z
Proceed? y
Key for minion iZ2803zsab7Z accepted.





1
2
3
root@iZ23f6c5z8tZ:~# salt '*'test.ping
iZ2803zsab7Z:
    True



页: [1]
查看完整版本: ubuntu14.04安装saltstack