salt 安装
list:
centos 6.5 x86_64
172.18.39.28 mast.test.com
172.18.39.27 mini.test.com
master:
#sudo yum install https://repo.saltstack.com/yum/redhat/salt-repo-latest-1.el6.noarch.rpm
#yum install salt-master salt-minion salt-ssh salt-syndic salt-cloud salt-api
#vim /etc/hosts
172.18.39.28 salt.test.com
#vim /etc/salt/master
##源目录路径
# file_roots:
base:
- /srv/salt/
##
#service salt-master restart
#vim /etc/sysconfig/network ##修改主机名
mini:
#sudo yum install https://repo.saltstack.com/yum/redhat/salt-repo-latest-1.el6.noarch.rpm
##yum install salt-minion
#vim /etsyconfig/network ##修改主机名
#vim /etc/hosts
172.18.39.28 salt.test.com
#vim /etc/minion
master: salt.test.com
#service salt-minion restart
master:
salt-key -y -a mini.test.com ##接受key
##
##
###
salt-key -d mini.test.com ##删除KEY
例子:
maser:
mkdir /srv/salt//qing/files -p
#vim init.sls
include:
- qing.aa
run:
cmd.run:
- name: |
mkdir /tmp/bb
/tmp/aa.txt:
file:
- managed
- source: salt://qing/files/aa.txt
- user: root
- group: root
- mode: 644
#vim files/aa.txt
testset
##
推送命令:
salt mini.test.com state.sls qing ##默认执行init.sls文件
salt mini.test.com state.sls qing.xxx