Open the system's own pillar on master:
[Email protected] ~]# Vim/etc/salt/master
556 Pillar_opts:true
[Email protected] ~]#/etc/init.d/salt-master restart
Stopping salt-master daemon: [OK]
Starting Salt-master daemon: [OK]
[[email protected] ~]# Salt ' * ' pillar.items =======> display system comes with pillar
Pillar Application Scenarios:
1 Sensitive data: such as user name and password
2 Handling of variance variables
[[email protected] ~]# vim/etc/salt/master ==========> Open the following options
533 Pillar_roots:
534 Base:
535-/srv/pillar
556 Pillar_opts:false
[Email protected] srv]# mkdir pillar
[Email protected] srv]#/etc/init.d/salt-master restart
Stopping salt-master daemon: [OK]
Starting Salt-master daemon: [OK]
Example 1:
[Email protected] pillar]# Cat/srv/pillar/apache.sls
{% if grains[' os '] = = ' CentOS '%} if the system is CentOS
APACHE:HTTPD Displays the httpd
{% elif grains[' os '] = = ' Debian '%} if the system is Debian
APACHE:APACHE2 Displays the Apache2
{% ENDIF%}
[[email protected] pillar]# Cat/srv/pillar/top.sls ========>pillar top file
Base
‘*‘:
-Apache
[[email protected] pillar]# Salt ' * ' Pillar.items ========> get pillar value
Linux-node2.example.com:
----------
Apache:
httpd
Linux-node1.example.com:
----------
Apache:
httpd
Example 2: Locating the host
[[email protected] pillar]# Salt ' * ' Saltutil.refresh_pillar =======> refresh pillar
Linux-node1.example.com:
True
Linux-node2.example.com:
True
[[email protected] pillar]# salt-i ' apache:httpd ' test.ping =========> Locate host
Linux-node2.example.com:
True
Linux-node1.example.com:
True
Old boy Website: http://www.etiantian.org/
qq:406564728
Welcome to make valuable suggestions
This article is from the "Linux" blog, so be sure to keep this source http://chenjisong.blog.51cto.com/7858025/1714022
The pillar of Saltstack data system