saltstack将minion客户端分组批量处理
现在我有6台主机,要将他们进行分组,这样管理起来比较方便比如redhat、centos、各自分组。
1
ddcluster1,hddcluster2,hddcluster3,hddcluster4,salt-master,salt-minion01
修改master的配置文件中的nodegroups
vim /etc/salt/master
1
2
3
4
5
6
7
8
9
10
11
12
#nodegroups:
#group1: 'L@foo.domain.com,bar.domain.com,baz.domain.com or bl*.domain.com'
#group2: 'G@os:Debian and foo.domain.com'
#group3: 'G@os:Debian and N@group1'
#group4:
# - 'G@foo:bar'
# - 'or'
# - 'G@foo:baz'
nodegroups:
redhat-group: 'L@hddcluster1,hddcluster2,hddcluster3,hddcluster4'
centos-group: 'L@salt-master,salt-minion01'
redhat-centos-group: 'L@hddcluster1,salt-minion01'
不需要重启master
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# salt -N redhat-group test.ping
hddcluster3:
True
hddcluster1:
True
hddcluster4:
True
hddcluster2:
True
# salt -N centos-group test.ping
salt-master:
True
salt-minion01:
True
#
# salt -N centos-group cmd.run 'df -h'
salt-master:
Filesystem SizeUsed Avail Use% Mounted on
/dev/mapper/centos-root 50G5.0G 46G10% /
devtmpfs 3.9G 03.9G 0% /dev
tmpfs 3.9G116K3.9G 1% /dev/shm
tmpfs 3.9G 41M3.8G 2% /run
tmpfs 3.9G 03.9G 0% /sys/fs/cgroup
/dev/sda2 494M133M362M27% /boot
/dev/sda1 200M9.5M191M 5% /boot/efi
/dev/mapper/centos-home873G1.3G872G 1% /home
tmpfs 786M 20K786M 1% /run/user/42
tmpfs 786M4.0K786M 1% /run/user/0
tmpfs 3.9G 16K3.9G 1% /tmp
salt-minion01:
Filesystem SizeUsed Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root
6.5G805M5.4G13% /
tmpfs 245M 12K245M 1% /dev/shm
/dev/vda1 477M 30M422M 7% /boot
#
# salt -N redhat-centos-group test.ping
salt-minion01:
True
hddcluster1:
True
页:
[1]