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

pillar_roots:

   base:

      - /srv/pillar

Here, the file is in the “/srv/pillar” directory.

Consider, the top file located in /srv/pillar/top.sls has the following structure

base:

   '*':

      - default

Now, move to the default.sls file located in /srv/pillar/default.sls and add the following code.

# Default pillar values

apache

git

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

Pillar Items

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

Recent Comments

No comments

Leave a Comment