码迷,mamicode.com
首页 > 其他好文 > 详细

salt nodegroup

时间:2016-01-19 01:49:46      阅读:168      评论:0      收藏:0      [点我收藏+]

标签:saltstack   分组   nodegroup   

salt分组配置

我是以ip地址作为minion的id,这样在master上管理的时候,一目了然的知道是哪台minion。要是有dns的支持就更好了,直接规范主机名。

一、依靠nodegroups

编辑master的配置文件:

加入一行:default_include: include/group.conf

编辑default_include: include/group.conf:

nodegroups:

lvs: ‘L@192.168.122.102,192.168.122.103‘

dns: ‘L@192.168.122.100‘

之后在命令行可以这样执行:

salt -N lvs test.ping

salt -N lvs test.ping

salt-cp -N lvs /var/www/html/soft/lvs/install_lvs.sh /tmp/install_lvs.sh



salt的nodegroup结合sls文件做按组操作。

vim /etc/salt/master

interface: 0.0.0.0

publish_port: 4505

user: root

worker_threads: 5

ret_port: 4506

root_dir: /

pki_dir: /etc/salt/pki/master

keep_jobs: 24

timeout: 5

state_top: top.sls

file_roots:

base:

– /srv/salt

pillar_roots:

base:

– /srv/pillar

log_file: /var/log/salt/master

log_level: warning


default_include: include/group.conf


vim /etc/salt/include/group.conf

nodegroups:

lvs: ‘L@192.168.122.102,192.168.122.103‘

dnsmasq: ‘L@192.168.122.100,192.168.122.101,192.168.122.102,192.168.122.103‘

————

[root@salt-master salt]# ls /srv/salt/

dnsmasq mypkgs myscript top.sls

vim /srv/salt/top.sls

base:

‘dnsmasq‘:

– match: nodegroup

– dnsmasq

‘lvs‘:

– match: nodegroup

– myscript.lvs


salt -N ‘lvs‘ state.sls myscript.lvs

salt -N ‘dnsmasq‘ state.sls dnsmasq


本文出自 “创者思” 博客,请务必保留此出处http://strongit.blog.51cto.com/10020534/1736302

salt nodegroup

标签:saltstack   分组   nodegroup   

原文地址:http://strongit.blog.51cto.com/10020534/1736302

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!