Pre-Lab Environment:
[Email protected] ~]# salt-key-l
[Email protected] ~]# salt-key-a super65.cn-y
Introduction to Salt Management Objects:
The object that Saltstack manages is called Target.
Many of the objects we manage are those we need to classify different objects. How does the Saltstack classify it?
It is important to plan the ID of the target in the pre-saltstack if it is possible to automate or depend on the ID of the object when managing the object.
1. Regular matching
[Email protected] ~]# salt-e "super.*" test.ping
SUPER66:
True
super65.cn:
True
[Email protected] ~]# salt-e "super.*cn$" test.ping
super65.cn:
True
2. List matching
[Email protected] ~]# salt-l super66,super65.cn test.ping
SUPER66:
True
super65.cn:
True
[Email protected] ~]# salt-l super66 test.ping
SUPER66:
True
3. Grians Matching
[Email protected] ~]# salt-g "Os:centos" test.ping
SUPER66:
True
super65.cn:
True
Grians is a component that saltsatack a custom record minion static information (such as recording CPU, memory, and).
View Grians Help:
[email protected] ~]# Salt ' super66 ' sys.doc grains
4. Group Matching
Define groups (to be defined in the master configuration file)
[Email protected] ~]# salt-n group1 test.ping
SUPER66:
True
[Email protected] ~]# salt-n group2 test.ping
SUPER66:
True
super65.cn:
True
5. Cird Matching
[Email protected] ~]# salt-s "192.168.1.0/24" test.ping
SUPER66:
True
super65.cn:
True
6, composite matching (support the above matching rules with and, or association)
7, pillar value matching (pillar system can be customized key value pairs)
Iv. Saltstack How to manage objects?