標籤:automation
[[email protected]_server home]# ifconfig eth0 | grep "inet addr:" | awk -F: ‘{print $2}‘ | awk ‘{print $1}‘ 192.168.100.228 [[email protected]_server home]# cat /etc/redhat-release CentOS release 6.3 (Final) [[email protected]_server home]# uname -r 2.6.32-279.el6.x86_64 [[email protected]_server home]#
http://ftp.linux.ncsu.edu/pub/epel/6/x86_64/
參考文章
http://docs.saltstack.cn/topics/installation/rhel.html
在安裝之前需要注意幾個包
Python 不用說大家都知道 這玩意就python寫的 ZeroMQ 訊息中介軟體相當於puppet的rabbitMQ、activeMQ PyCrypto Python密碼工具包 M2Crypto 加密模組 是Python OpenSSL封裝 msgpack-python 高效能的訊息交換格式 YAML 不說大家都知道 檔案格式 Jinja2 解析Salt States (在master設定檔中配置) MarkupSafe Implements a XML/HTML/XHTML Markup safe string for Python apache-libcloud 與大量的主流雲端服務提供者進行互動時統一API的Python類
在安裝之前我們需要設定防火牆的連接埠
lokkit -p 4505:tcp -p 4506:tcp
一、安裝master salt-master 2014.1.1版本
下載安裝
記住路徑下次直接安裝不需要下載
如果想本地儲存需要緩衝
vim /etc/yum.conf
keepcache=1 修改成1
安裝master 17.0.5版本,首先要安裝好本地源碼
[[email protected]_server mnt]# yum install python-jinja2 [[email protected]_server mnt]# yum install salt-master
安裝minion 17.0.5版本
[[email protected]_client1 ~]# yum install python-jinja2 [[email protected]_client1 ~]# yum install salt-minion
三、啟動master
[[email protected]_server ~]# vim /etc/salt/master 如下是正確寫法不然會報錯
#interface: 0.0.0.0 interface: 192.168.100.228 [[email protected]_server ~]# /etc/rc.d/init.d/salt-master start Starting salt-master daemon: [ OK ] [[email protected]_server ~]# chkconfig --level 35 salt-master on [[email protected]_server ~]#
四、修改minion然後啟動
[[email protected]_client1 ~]# cat /etc/salt/minion | grep 100.228 master: 192.168.100.228 這個maste可以填寫maste的主機名稱也可以使ip地址 [[email protected]_client1 ~]#
還需要修改id 這個ID是伺服器標識用戶端的東西,如果配置ID 服務端將是以ID的 名字為標準,需要注意
id: salt_client1
[[email protected]_client1 ~]# /etc/rc.d/init.d/salt-minion start Starting salt-minion daemon: [ OK ] [[email protected]_client1 ~]# chkconfig --level 35 salt-minion on [[email protected]_client1 ~]#
五、在master上查看是否有用戶端key的請求
[[email protected]_server ~]# salt-key -L Accepted Keys: Unaccepted Keys: salt_client1 Rejected Keys: [[email protected]_server ~]#
六、master來批准用戶端的請求檔案
—————A是通過用戶端全部的請求檔案
—————d是這個選項是刪除認證請求檔案
[[email protected]_server ~]# salt-key -a salt_client1 The following keys are going to be accepted: Unaccepted Keys: salt_client1 Proceed? [n/Y] Y Key for minion salt_client1 accepted. [[email protected]_server ~]#
如果不想去手動確認,那麼我們修改設定檔就可以自動確認
修改設定檔vim /etc/salt/master
#auto_accept: False
去掉其中的#號 把False修改成True就可以
查看key
[[email protected]_server base]# salt-key -f salt_client1 Accepted Keys: salt_client1: 20:a6:2d:6b:24:4a:a9:bc:77:72:ba:6f:30:22:20:7f [[email protected]_server base]# salt ‘salt_client1‘ cmd.run ‘salt-call key.finger --local‘ salt_client1: local: 20:a6:2d:6b:24:4a:a9:bc:77:72:ba:6f:30:22:20:7f [[email protected]_server base]#
測試:
[[email protected]_server ~]# salt ‘salt*‘ test.ping salt_client1: True salt_client2: True [[email protected]_server ~]#
本文出自 “營運之家(Q群:1991706)” 部落格,請務必保留此出處http://304076020.blog.51cto.com/7503470/1553222
Centos 6上安裝Saltstack