Salt stack pillar component
Pillar is an essential component to make Salt states reusable. It is used to define secure data for minions assigned using targets. Salt pillar data stores values such as ports, file paths, configuration parameters, and passwords.
Pillar config File
The configuration for the pillar_roots in the master config file is shown below
Here, the file is in the “/srv/pillar” directory.
Consider, the top file located in /srv/pillar/top.sls has the following structure
Now, move to the default.sls file located in /srv/pillar/default.sls and add the following code.
# Default pillar values
After saving the file, refresh the pillar to update all the changes.
We can refresh the pillar using the following command.
#salt '*' saltutil.refresh_pillar
The above command is used to refresh the Salt pillar data on all the minions.
List Pillar Data
To list out the pillar data, we can use the command given below
#salt '*' pillar.ls
Once the pillar is set up, the data can be viewed on the minion via the pillar module. It can be accessed through the function pillar.items, which are defined below.
#salt '*' pillar.items