The main function of pillar in Saltstack is to store and define some data needed in configuration management, such as software version number, user name password and other information, its definition storage format is similar to grains, it is YAML format
The primary role of Pillar in Saltstack is to store and define some of the data needed in configuration management
There is a pillar settings option in the master configuration file that specifically defines some pillar related parameters:
#pillar_roots:
# Base:
#-/srv/pillar
Need to understand pillar_roots related configuration, pillar working directory under the default base environment in/srv/pillar directory
If you want to define a different pillar working directory for multiple environments, you only need to modify this configuration file to
Here we use the default path, if you use the default path, create the directory Mkdir-pv/srv/pillar
Create a Top.sls portal file in the pillar directory that references two files
Base: #指定环境
' * ' #target
-Packages #引用packages. SLS or Packages/init.sls
-Services #同上
Create a Packages.sls file
Zabbix
Package-name:zabbix
version:2.2.4
Create a Services.sls file
Zabbix
port:10050
User:admin
Use the following command to view some of the module usages related to pillar
Salt ' minion1 ' sys.list_functions pillar
Minion1:
-Pillar.data
-Pillar.ext
-Pillar.get
-Pillar.item
-Pillar.items
-Pillar.raw
Detailed usage and examples can be viewed through the command salt ' minion ' Sys.doc pillar
View the pillar that you just defined
Salt ' minion1 ' Pillar.item Zabbix
Minion1:
----------
Zabbix
----------
Package-name:
Zabbix
Port
10050
User
Admin
Version
2.2.4
--------------------------------------------------------------------------
Saltstack supports reading pillar data externally, we can store pillar data on a database or storage server, where it is not stored and used.
This article from "Eight Miles" blog, declined reprint!
Saltstack Study Notes 5-pillar